How do I install wxPython in virtualenv
macos, python, virtualenv, windows, wxpython
Solution
For others, here is what worked for me:
On Mac OSX, I installed wxpython with Homebrew using:
brew install wxpython
Change into your virtualenv site-packages directory:
cd /venv/lib/python2.7/site-packages
then link the wx.pth
ln -s /usr/local/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx.pth wx.pth
and then link the wx-3.0-osx_cocoa directory:
ln -s /usr/local/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx-3.0-osx_cocoa wx-3.0-osx_cocoa
Problem
I'm on a Mac OSX Lion machine, and I've downloaded wxPython-src-2.9.3.1.tar.bz2. I then did the following (note: output messages have been removed): ``` $ tar -xjf wxPython-src-2.9.3.1.tar.bz2 $ cd wxPython-src-2.9.3.1 $ mkdir bld $ cd bld $ source /path/to/myvirtualenv/bin/activate (myvirtualenv)$ cross_compiling=yes (myvirtualenv)$ export MACOSX_DEPLOYMENT_TARGET=10.6.7 (myvirtualenv)$ set arch_flags="-arch ppc64 " (myvirtualenv)$ ../configure \ --with-mac --enable-monolithic --enable-threads --enable-unicode \ --enable-debug_flag --enable-debug \ --with-libpng --with-libjpeg --with-libtiff --enable-unicode \ --with-opengl --enable-graphics_ctx --with-odbc --enable-gui \ --with-macosx-sdk=/Developer/SDKs/MacOSX10.6.sdk --with-macosx-version-min=10.6 \ CFLAGS="$arch_flags" CXXFLAGS="$arch_flags" CPPFLAGS="$arch_flags" LDFLAGS="$arch_flags" OBJCFLAGS="$arch_flags" OBJCXXFLAGS="$arch_flags" --prefix=/path/to/myvirtualenv/ $ (myvirtualenv)make $ (myvirtualenv)make install ``` After that, I did get this message (so I guess it succeeded): ``` ... ------------------------------------------------------ The installation of wxWidgets is finished. On certain platforms (e.g. Linux) you'll now have to run ldconfig if you installed a shared library and also modify the LD_LIBRARY_PATH (or equivalent) environment variable. wxWidgets comes with no guarantees and doesn't claim to be suitable for any purpose. Read the wxWindows Licence on licencing conditions. ------------------------------------------------------ ``` And returned me to my shell. However, I cannot seem to use it ``` (myvirtualenv)$ python >>> import wxversion Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named wxversion ``` Any ideas how I can have it installed in my virtualenv?