Skip to content


wxPython4 (4.0.0b1) on Raspberry Pi 3 Debian 8 Jessie

wxPython-4.0.0a1 has been released in April 2017, unfortunately, there is no wheel build for raspbian.
Using the following command build wxpython each time :

pip install wxpython==4.0.0b1

So, for now, if you want to build wxPython-4 on your raspberry pi 3, and get a plug-and-play and re-usable tarball for others rpi, you can follow those instructions :

Build preparation

about 2,7G will be needed to build wxPython.

apt install dpkg-dev build-essential python3.4-dev libwebkitgtk-dev \
            libjpeg-dev libtiff-dev libgtk2.0-dev libsdl1.2-dev \
            libgstreamer-plugins-base0.10-dev libnotify-dev freeglut3 \
cd /home/pi
mkdir wxp4
cd wxp4
wget -O wxPython-4.0.0b1.tar.gz ''
tar xzvf wxPython-4.0.0b1.tar.gz
rm wxPython-4.0.0b1.tar.gz
cd wxPython-4.0.0b1/


Be sure to make all following step in the same shell where ${wxp_opts} is defined

wxp_opts="${wxp_opts} --python=/usr/bin/python3.4"
wxp_opts="${wxp_opts} --jobs=1"  # more than one jobs my require more memory than the 1GB available on RPi3
wxp_opts="${wxp_opts} --nodoc"
wxp_opts="${wxp_opts} --release"
wxp_opts="${wxp_opts} --unicode"
time python3.4 ${wxp_opts} build_wx

real 61m47.094s
user 58m4.340s
sys 1m51.910s

time python3.4 ${wxp_opts} build_py

To use wxPython from the build folder (without installing):
– Set your PYTHONPATH variable to /home/pi/wxp4/wxPython-4.0.0b1.
– You may also need to set your (DY)LD_LIBRARY_PATH to /home/pi/wxp4/wxPython-4.0.0b1/build/wxbld/lib,
or wherever the wxWidgets libs have been installed.

Finished command: build_py (188m44.303s)

real 188m45.462s
user 182m32.760s
sys 5m23.100s

time python3.4 ${wxp_opts} bdist

You have your build available here :



For example :

mkdir ~/dev
cd ~/dev
virtualenv --python=python3.4 --distribute --no-site-packages --unzip-setuptools myvirtualenv
tar xf /home/pi/wxp4/wxPython-4.0.0b1/dist/wxPython-4.0.0b1-linux-py3.4.tar.gz -C ~/dev/myvirtualenv/
echo "${HOME}/dev/myvirtualenv/wxPython-4.0.0b1-linux-py3.4/" >~/dev/myvirtualenv/lib/python3.4/site-packages/wxpython.pth
source ~/dev/myvirtualenv/bin/activate
$ python -c 'import wx; print(wx.version())'
4.0.0b1 gtk2 (phoenix)

wxPython ( on OS X El Capitan (10.11)

Since OS X 10.11 (El Capitan), the lastest version of the available wxPython dmg ( have an unsupported pkg structure. You can see an open bug at

Thanks to memoselyk@stackoverflow we can convert manually the package structure to be able to install it : ; you can find an updated version of the method below :

Installing wxPython- on OS X El Capitan :

# base workdir
mkdir ~/wxpython_elcapitan
cd ~/wxpython_elcapitan

# download the wxPython dmg
curl -L "" -o wxPython3.0-osx-

# mount the dmg
hdiutil attach wxPython3.0-osx-

# copy the dmg package to the local disk
mkdir ~/wxpython_elcapitan/repack_wxpython
cd ~/wxpython_elcapitan/repack_wxpython
cp -r /Volumes/wxPython3.0-osx- .

# unmount the dmg
dmgdisk="$(hdiutil info | grep '/Volumes/wxPython3.0-osx-' | awk '{ print $1; }')"
hdiutil detach ${dmgdisk}

# prepare the new package contents
mkdir ~/wxpython_elcapitan/repack_wxpython/pkg_root
cd ~/wxpython_elcapitan/repack_wxpython/pkg_root
pax -f ../wxPython3.0-osx-cocoa-py2.7.pkg/Contents/Resources/wxPython3.0-osx-cocoa-py2.7.pax.gz -z -r
cd ~/wxpython_elcapitan/repack_wxpython

# prepare the new package scripts
mkdir ~/wxpython_elcapitan/repack_wxpython/scripts
cp wxPython3.0-osx-cocoa-py2.7.pkg/Contents/Resources/preflight scripts/preinstall
cp wxPython3.0-osx-cocoa-py2.7.pkg/Contents/Resources/postflight scripts/postinstall

# delete the old package
rm -rf ~/wxpython_elcapitan/repack_wxpython/wxPython3.0-osx-cocoa-py2.7.pkg

# build the new one :
pkgbuild --root ./pkg_root --scripts ./scripts --identifier com.wxwidgets.wxpython wxPython3.0-osx-cocoa-py2.7.pkg

# put the package on Desktop, and clean workdir
mv ~/wxpython_elcapitan/repack_wxpython/wxPython3.0-osx-cocoa-py2.7.pkg ~/Desktop/
cd ~
rm -rf ~/wxpython_elcapitan

# install it ! it will ask for your password (to become superuser/root)
sudo installer -pkg ~/Desktop/wxPython3.0-osx-cocoa-py2.7.pkg -target /


wxPython is now available on your OS X El Capitan :

$ python -c “import wx ; print wx.version()” osx-cocoa (classic)

Using wxPython in a VirtualEnv :

OS X is now restricting screen access to a trusted list of Frameworks and binaries, and a standard VirtualEnv is not enought :

This program needs access to the screen.
Please run with a Framework build of python, and only when you are
logged in on the main display of your Mac.

Thanks to the wxPython wiki, we can find some ways to solve that :
See :

Below, a quick solution, assuming that you don’t want system packages in your virtual env :

mkdir ~/dev
cd ~/dev
virtualenv --python=python2.7 --distribute --no-site-packages --unzip-setuptools myvirtualenv
source ~/dev/myvirtualenv/bin/activate
ln -s /Library/Python/2.7/site-packages/wxredirect.pth ~/dev/myvirtualenv/lib/python2.7/site-packages/wxredirect.pth

And now you must use the system python interpreter, instead the one in your virtual env, you should use a script, a wrapper, or modify activate script, but the minimum is :

PYTHONHOME="/Users/davixx/dev/myvirtualenv/" /usr/bin/python -c "import wx ; app = wx.App()"

Have a nice day with Mercy – MUSE