Iva*_*ets 9 python wxwidgets enthought
我正在使用Enthought Python Distribution(7.2,64位).它没有wxPython(这非常重要).但是,wxPython-2.9似乎支持64位Cocoa接口,所以我试了一下.实际上,这一切都很顺利:命令
python build-wxpython.py --osx_cocoa --mac_framework --install
Run Code Online (Sandbox Code Playgroud)
成功编译,甚至进入EPD网站包.但是,一个简单的wxPython代码
import wx
wx.App()
Run Code Online (Sandbox Code Playgroud)
失败,出现以下错误:
This program needs access to the screen.
Please run with a Framework build of python, and only when you are
logged in on the main display of your Mac.
Run Code Online (Sandbox Code Playgroud)
你能给我一些如何治愈的建议吗?EPD显然是一个Python框架(即,查看/Library/Frameworks/EPD64.framework和/Library/Frameworks/Python.framework让我信服它)但是这个wxPython构建并不知道.wxPython的版本是2.9.3.1
小智 1
使用这样的包装器脚本应该以 wxPython 正常工作的方式设置您的环境:
#!/bin/bash
# Real Python executables to use
PYVER=2.7
PYTHON=/Library/Frameworks/Python.framework/Versions/$PYVER/bin/python$PYVER
# Figure out the root of your EPD env
ENV=`$PYTHON -c "import os; print os.path.abspath(os.path.join(os.path.dirname(\"$0\"), '..'))"`
# Run Python with your env set as Python's PYTHONHOME
export PYTHONHOME=$ENV
exec $PYTHON "$@"
Run Code Online (Sandbox Code Playgroud)
只需将其转储到文件中,授予其可执行权限,然后使用它来启动 wxPython 应用程序而不是 python 可执行文件。
| 归档时间: |
|
| 查看次数: |
2787 次 |
| 最近记录: |