Install wxPython for python2.6 on Ubuntu 12.04

At least myself did not find the proper wxPython binary for python2.6 on Ubuntu 12.04. Steps blow is how I compile it from source.

(1) Install gtk+-2.0 development package

sudo apt-get install libgtk2.0-dev

(2) Install python2.6-dev

Package python2.6-dev is not available any more on 12.04 directly, however there’s a repo

sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get install python2.6-dev

(3) Download wxPython source package

axel -n 20 -a http://downloads.sourceforge.net/project/wxpython/wxPython/2.8.11.0/wxPython-src-2.8.11.0.tar.bz2
tar jxvf wxPython-src-2.8.11.0.tar.bz2

(4) Compile 

cd wxPython-src-2.8.11.0/wxPython   
python2.6 setup.py  build
python2.6 setup.py  build_ext --inplace --debug

You can also change “config.py” to make some configurations, for example disable and enable features.

(5) Install

sudo python2.6 setup.py  install

There’s a warning which complains release number mismatch. Did not have the time to dig it out.

Python 2.6.8 (default, May 12 2012, 12:41:44)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
/usr/local/lib/python2.6/dist-packages/wx/_core.py:14512: UserWarning: wxPython/wxWidgets release number mismatch
  warnings.warn("wxPython/wxWidgets release number mismatch")
>>>