我最近安装了 python 2.7.3(来自 2.6),并且不小心在我的 Mac 上重新安装了 wxPython 2.8 unicode。现在,当我尝试导入 wx 时,我得到
>>> import wx
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
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 <module>
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 <module>
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
为什么是这样?我做到了defaults write com.apple.versioner.python Prefer-32-Bit -bool yes
,并且print("%x" % sys.maxsize, sys.maxsize > 2**32)
仍然返回('7fffffffffffffff', True)
。这是否意味着它在 64 位模式下运行?如果是这样,这就是我收到此错误的原因吗?
编辑:在 python2.6 中导入 wx 时也会发生这种情况。但是什么都不应该改变,因为我有相同版本的 wxPython。
另一个编辑:使用arch
,我确定这是因为它在 64 位模式下运行。但是,尽管Prefer-32-Bit -bool yes
. 为什么会这样?我注意到 /usr/bin/python 仍然运行 2.6。