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?
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.
If you can import wx
then it is working.
How are you trying to import App
and Frame
etc?
You only need to do
import wx
app= wx.App()
or if you do only want to import App
and Frame
then,
from wx import Frame, App
app = App()
frame = Frame(None)
brew install wxpython
import site; site.getsitepackages()
import site; site.getsitepackages()
, you will get the site of site-packages, for example: '/Library/Python/2.7/site-packages' cd /Library/Python/2.7/site-packages
ln -s /usr/local/Cellar/wxpython/3.0.2.0/lib/python2.7/site-packages/wx-3.0-osx_cocoa/wx wx
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.