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
tar jxvf wxPython-src-

(4) Compile 

cd wxPython-src-   
python2.6  build
python2.6  build_ext --inplace --debug

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

(5) Install

sudo python2.6  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/ UserWarning: wxPython/wxWidgets release number mismatch
  warnings.warn("wxPython/wxWidgets release number mismatch")