【发布时间】:2011-09-08 03:00:16
【问题描述】:
我度过了一个非常令人沮丧的夜晚,试图让wxpython 在我的 MacBook Pro(运行 Snow Leopard 10.6.6)上工作。通过阅读此处和其他网站上有关该主题的各种主题,这是我迄今为止的理解:
- 如果您运行的是 python 2.6 或更高版本,则只有在访问 32 位版本时才能使用 wxpython
- 在命令行提示符下键入
python表明我正在使用python 2.6.1。 - 键入
which python返回/usr/bin/python,所以我使用的是随操作系统安装的默认版本。这意味着在命令行提示符下键入以下内容defaults write com.apple.versioner.python Prefer-32-Bit -bool yes应该将我正在使用的版本更改为 32 位版本。 - 完成上述操作后,我现在只需输入我的 python 文件的名称(导入了
wx模块),我的文件就会成功运行。
毫无疑问,您可以猜到我的文件没有成功运行。我不知道发生了什么,但也许其他人可以在这里提供一些其他可能有帮助的观察结果......
键入help(), modules 会产生以下消息,然后打印出模块,包括wx 和wxpython
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/pkgutil.py:110: DeprecationWarning: The wxPython compatibility package is no longer automatically generated or actively maintained. Please switch to the wx package as soon as possible.
__import__(name)
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/pkgutil.py:110: DeprecationWarning: twisted.flow is unmaintained.
__import__(name)
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/python/filepath.py:12: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
import sha
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/words/im/__init__.py:8: UserWarning: twisted.im will be undergoing a rewrite at some point in the future.
warnings.warn("twisted.im will be undergoing a rewrite at some point in the future.")
Fri Jun 3 22:23:48 Paul-Pattersons-MacBook-Pro.local python[3208] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
然后检查wx 模块,特别是产生...
NAME
wx
FILE
/usr/local/lib/wxPython-unicode-2.8.12.0/lib/python2.6/site-packages/wx-2.8-mac-unicode/wx/__init__.py
谁能帮忙?
【问题讨论】:
标签: macos wxpython 32bit-64bit