1、今天试着安装了一下wxpython,进入python,import wx,结果报如下错误:
File "GUItest.py", line 2, in
import wx
File "/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/__init__.py", line 45, in
from wx._core import *
File "/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core.py", line 4, in
import _core_
ImportError: dlopen(/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core_.so, 2): no suitable image found. Did find:
/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core_.so: no matching architecture in universal wrapper
使用运行python-32,然后再import wx 则不会报错!
一看就知道是wx是32位的!为此时的Mountain Lion 为64为系统!
解决办法很多!
最后我用google搜索到:重新下载一个基于Cocoa API中的wxPython的,那么你就不必担心架构问题啦。
下载地址:
wxPython 2.9:http://downloads.sourceforge.net/wxpython/wxPython2.9-osx-2.9.4.0-cocoa-py2.7.dmg
最后运敲了一段测试代码:测试成功啦!截图: