试行wxPython的凤凰在OS X上的Python 3.3(我不知道它是由Python 3的版本凤凰支持,我强制安装它。wxPython的Python的3 Miniconda环境
>>> import wx
>>> 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.
现在我读this它说有问题的wxPython与virtualenv中,并通过这个脚本进行了修正:
#!/bin/bash
# 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 "[email protected]"
我不能读BASH但看起来这只是一个设置PYTHONHOME的事(这是什么$ @?)。我在Python 3上运行wxPython Phoenix,而不是Python 2.而且我没有使用virtualenv 。我是Miniconda。我不知道在哪里设置PYTHONHOME。我将它设置在PYTHONHOME =“/ Users/username/miniconda3 /”中,但它不起作用。
'$ @'是脚本的参数。它只是在设置了一些环境变量之后将它们传递给python。 – asmeurer