Category Archives: wxPython

Building and installing wxPython 2.9.4.0 on Raspberry Pi (Raspbian)

As of writing the official release of the wxPython is version 2.8 which one could use apt-get install:

sudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-i18n libwxgtk2.8-dev libgtk2.0-dev

However, in my case, I need to use the WebView and it is available in version 2.9. This is the reason why I have to build and install wxPython 2.9.4.0 from source.

Download and Patch Source

cd ~
wget "http://downloads.sourceforge.net/project/wxpython/wxPython/2.9.4.0/wxPython-src-2.9.4.0.tar.bz2"
wget "http://downloads.sourceforge.net/project/wxpython/wxPython/2.9.4.0/wxPython-src-2.9.4.1.patch" 
tar xvjf wxPython-src-2.9.4.0.tar.bz2
patch -p 0 -d wxPython-src-2.9.4.0/ < wxPython-src-2.9.4.1.patch
mkdir wxPython-src-2.9.4.0/bld

Install Dependencies

sudo apt-get install dpkg-dev build-essential swig python-dev libwebkit-dev libjpeg-dev libtiff-dev checkinstall freeglut3 freeglut3-dev libgtk2.0-dev  libsdl1.2-dev libgstreamer-plugins-base0.10-dev libgstreamer0.10-dev libgconf2-dev libglapi-mesa libosmesa6 libglu1-mesa-dev libglu1-mesa mesa-common-dev

Note that I install mesa as well since wxPython requires OpenGL and mesa packages include OpenGL headers. Also, some packages above may not necessary but I install then since I was not sure.

Build and Install

This step takes hours (~8 hours).

cd wxPython-src-2.9.0.1/wxPython
python build-wxpython.py --build_dir=../bld --install

Note: make sure that python command that you use matches the version of the python that you are planning to use with wxPython. You may check the version by

python -V

Final Touch

The wx modules are placed under /usr/local/lib but when I run demo.py it does not recognize wx since modules were misplaced. I copy all the wx modules under /usr/local/lib to /usr/lib

sudo cp /usr/local/lib/libwx_*  /usr/lib

Now you can try the demo under

python demo/demo.py