与 wxpython 战斗

发布于 2024-11-13 11:28:44 字数 2057 浏览 2 评论 0原文

我花了一个非常令人沮丧的夜晚试图让 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 会产生以下消息然后打印出模块,包括 wxwxpython

/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/pkgutil .py:110: DeprecationWarning: wxPython 兼容性包不再自动生成或主动维护。请尽快切换到wx包。

__import__(name)

/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ pkgutil.py:110:DeprecationWarning:twisted.flow 未维护。

__import__(name)

/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib /python/twisted/python/filepath.py:12:DeprecationWarning:sha 模块已弃用;请改用 hashlib 模块

import sha

/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/twisted/words/im/__init__。 py:8: 用户警告:twisted.im 将在未来某个时候进行重写。 warnings.warn("twisted.im 将在未来某个时候进行重写。")

Fri Jun 3 22:23:48 Paul-Pattersons-MacBook-Pro.local python[3208] <错误>:kCGErrorFailure:设置断点 @ CGErrorBreakpoint() 以捕获记录的错误。

_RegisterApplication(),无法建立到 WindowServer 的默认连接,_CGSDefaultConnection() 为 NULL。< /code>

然后专门检查 wx 模块,结果...

NAME wx

文件 /usr/local/lib/wxPython-unicode-2.8.12.0/lib/python2.6/site-packages/wx-2.8-mac-unicode/wx/__init__.py

有人可以帮忙吗?

I've spent a very frustrating evening trying to get wxpython to work on my MacBook Pro (running Snow Leopard 10.6.6). From reading the various threads on this topic both here and on other websites this is my understanding so far:

  • If you are running python 2.6 or greater you can only work with wxpython if you access the 32-bit version
  • Typing python at the command line prompt reveals that I am using python 2.6.1.
  • Typing which python returns /usr/bin/python so I'm using the default version installed with my OS. This means that typing the following at the command line prompt
    defaults write com.apple.versioner.python Prefer-32-Bit -bool yes should change the version I'm using to the 32 bit version.
  • With the above in place, I can now simply type the name of my python file (with the wx module imported) and my file will run successfully.

As you can no doubt guess however my file doesn't run successfully. I can't figure out what's going on, but maybe someone else can here are some other observations that might help...

typing help(), modules yields the following message and then prints out the modules, including wx and 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.

Then examining the wx module specifially yields...

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

Can anyone help?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

多像笑话 2024-11-20 11:28:44

我没有 Mac,但我阅读了 wxPython 邮件列表上的几乎所有消息。据我了解,您不想使用 Mac 附带的 Python。它已经以某种方式专门针对 Mac 进行了修改,因此您应该下载普通版本的 Python 并安装它。

至于32位问题,使用wxPython 2.8,你是正确的。由于 Carbon API,您只能使用 32 位。然而,如果你向下滚动下载页面(http://wxpython.org/download.php),你会看到 wxPython 2.9 已经发布,并且它有一个 Cocoa 版本,(我引用)“至少需要 OSX 10.5,并支持 32 位或 64 位架构”和 Python 2.7。

我强烈建议您去 wxPython 邮件列表寻求帮助。 wxPython 的作者也在场,他使用 Mac,名单上还有其他几位 Mac 爱好者可以回答此类问题。

I don't have a Mac, but I read almost all the messages on the wxPython mailing list. As I understand it, you don't want to use the Python that came with your Mac. It has been modified for the Mac specifically somehow, so you should download a normal version of Python and install it.

As for the 32-bit question, with wxPython 2.8, you are correct. You are limited to 32-bit because of the Carbon API. However, if you scroll down the download page (http://wxpython.org/download.php) you will see that wxPython 2.9 has been released and it has a Cocoa build which (and I quote) "requires at least OSX 10.5, and supports either 32-bit or 64-bit architectures" and Python 2.7.

I highly recommend that you go and seek help on the wxPython mailing list. The author of wxPython is there and he uses a Mac and there are several other Mac addicts on the list too that answer these sorts of questions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文