Wednesday, April 9, 2014

How to install wxPython

3:18 PM Posted by Peter Nguyen 2 comments

Bored of using Java for making GUI App, I want to switch to another language that can handle the cross-platform problem with GUI, wxPython comes into my cup of tea.

Unfortunately, since i'm using Ubuntu 12.04 to dev and all of the packages are pretty much outdated, plus the instruction is not clear enough on how to install wxPython 3.0.0 on Ubuntu 12.04. At first it created a lot of conflicts between packages but I managed to come up with good way to install wxPython 3.0.0 on Ubuntu 12.04:

1. Get all the dependencies needed: (it takes couple minutes)
sudo apt-get install dpkg-dev build-essential swig python2.7-dev libwebkitgtk-dev libjpeg-dev libtiff-dev checkinstall ubuntu-restricted-extras freeglut3 freeglut3-dev libgtk2.0-dev  libsdl1.2-dev libgstreamer-plugins-base0.10-dev 
2.  Download and create build directory: (Check for the lastest package at: )
tar xvjf wxPython-src-
cd wxPython-src-
mkdir bld
cd wxPython/
3. Build and Install:
sudo checkinstall -y --pkgname=wxpython --pkgversion=3.0.0 --pkgrelease=1 --pkglicense=wxWidgets --pkgsource= --requires=python-wxversion,python2.7,python -D  python --build_dir=../bld --install
4. To remove, just simply do:
dpkg -r wxpython

And that's it, we pretty much install it on our Ubuntu 12.04. You can check it by 'import wx' in python command line.

Note that when you first run you will run into some errors like:
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.6/dist-packages/wx-2.9.4-gtk2/wx/", line 45, in <module>
    from wx._core import *
  File "/usr/local/lib/python2.6/dist-packages/wx-2.9.4-gtk2/wx/", line 4, in <module>
    import _core_
ImportError: cannot open shared object file: No such file or directory
It is time to run this command in terminal 'sudo ldconfig' in order to get everything works.

Good luck :) !


  1. I just tried this on Linux Mint and it worked a charm first time! (well, once I'd done the 'sudo ldconfig'). Thanks so much for these instructions.

  2. configure: error: C compiler cannot create executables