Search code examples
pythonwxpythonosx-lionimporterror

Can't import wxPython on OSX Lion with Python 2.7.3 installed via Homebrew


I can't import wxPython on OSX Lion after installing wxPython from this package http://downloads.sourceforge.net/wxpython/wxPython2.9-osx-2.9.4.0-cocoa-py2.7.dmg.

I also tried to add wxPython directories to PYTHONPATH, but still, I cant import it. Installer created these folders:

/usr/local/lib/wxPython-2.9.4.0
/usr/local/lib/wxPython-unicode
/usr/local/lib/wxPython

I added them onto PYTHONPATH, but still no success. Still getting no module called wx.

When I tried to install it via pip (pip install wx), I was able to import wx, but unable to import wx.App(), wx.Frame() etc.

Any ideas?


Solution

  • I'm having a similar issue as you, but I was using homebrew and python brew and pip. I posted this in reddit: http://www.reddit.com/r/learnpython/comments/1063o1/wx_install_problems_os_x/

    Apparently, wx is not the same as wxpython.

    I used homebrew and installed wxmac instead to get it working.

    It might help a little.