在Mac OS X 10.6上面安装完wxPython后,使用wx时出现下面这样的错误:
Traceback (most recent call last):
File "", line 1, in
File "//usr/local/lib/wxPython-unicode-2.8.10.1/lib/python2.6/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.10.1/lib/python2.6/site-packages/wx-2.8-mac-unicode/wx/_core.py", line 4, in
import _core_
ImportError: /usr/local/lib/wxPython-unicode-2.8.10.1/lib/python2.6/site-packages/wx-2.8-mac-unicode/wx/_core_.so: no appropriate 64-bit architecture (see "man python" for running in 32-bit mode)
貌似需要本机上Python以32位来运行。有这样一种方式可以解决此问题:
给bash添加环境变量export VERSIONER_PYTHON_PREFER_32_BIT
在当前用户的HOME目录的.profile文件中添加如下一行:
export VERSIONER_PYTHON_PREFER_32_BIT=yes