Unfortunately, getting wxPython in a virtualenv is a painful process, and definitely takes some work. Here's the steps to do so:
- Download this patch, and save it as $HOME/wxpatch.txt.Without this patch, wxPython184.108.40.206 will fail to compile properly. Hopefully, this will be fixed in the next release.
- Make your virtualenv. If you're like me, you're going to be using virtualenvwrapper, so you'll run this command:
mkvirtualenv --no-site-packages wxpython
- Activate your virtualenv. If you are using the virtualenv wrapper I linked above, you would do "workon wxpython". Otherwise, it will be "source $PATH_TO_VENV/bin/activate".
- Download the wxPython source and save it as $HOME/wxPython-src-220.127.116.11.tar.bz2
- Now comes the messy command. Yes, all of these are genuinely necessary in order to make this work properly. Make sure to substitue "$PATH_TO_VENV" with the appropriate real path to the root of the virtual environment you made in step 2. Warning: The next steps will take a long time.
cd $HOME tar -xjf wxPython-src-18.104.22.168.tar.bz2 cd wxPython-src-22.214.171.124 patch -p0 < $HOME/wxpatch.txt ./configure --prefix=$PATH_TO_VENV --with-gtk=2 --enable-unicode --with-opengl make install cd contrib/src/stc make install cd ../gizmos make install cd ../../../wxPython python setup.py install
- Finally, you will need to ensure that your LD_LIBRARY_PATH variable is configured. If you are using the virtualenv wrappers mentioned above, create a script named $PATH_TO_VENV/bin/postactivate that has the following contents (no substitutions of any sort here at all!):
Now, set the script to be executable.
- If you're not using the virtualenv wrappers mentioned above, edit $PATH_TO_VENV/bin/activate and add that same line at the end of the file.