本人系统如下:
mac os x 系统 10.10.5
wxpython wxPython3.0-osx-3.0.2.0-carbon-py2.7
anaconda 3.17.0
无论是在qtconsole还是终端下都无法调用wxpython,表现如下:
Python 2.7.10 |Anaconda 2.3.0 (x86_64)| (default, Sep 15 2015, 14:29:08)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
import wx
app=wx.App()
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.
上google查到以下网址:
wxPythonVirtualenvOnMac
RunSnakeRun (wxPython) apps in a Brew Virtualenv
本人不是软件开发相关专业,python初学,英语一般般,实在看不懂网页内容。。。
请问怎样才能正确调用wxpython?
你的wxpython是不是安装在了virtualenv中?如果是的,尝试执行以下命令试试:
# what real Python executable to use
PYVER=2.7
PYTHON=/Library/Frameworks/Python.framework/Versions/$PYVER/bin/python$PYVER
# find the root of the virtualenv, it should be the parent of the dir this script is in
ENV=`$PYTHON -c "import os; print os.path.abspath(os.path.join(os.path.dirname(\"$0\"), '..'))"`
# now run Python with the virtualenv set as Python's HOME
export PYTHONHOME=$ENV
exec $PYTHON "$@"