Running winpdb from within Enthought Canopy on MacOS 10.9.2

时光总嘲笑我的痴心妄想 提交于 2019-12-12 09:15:38

问题


I have Enthought Canopy 1.4 installed on MacOS 10.9.2. Trying to run the winpdb debugger results in the following message:

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.

As a workaround, I tried creating a shell script run.sh, containing

PYVER=2.7
PYTHON=/System/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\"), '..'))"`
export PATH=$OLD_PATH

# now run Python with the virtualenv set as Python's HOME
export PYTHONHOME=$ENV
exec $PYTHON "$@"

Trying to run ./run.sh winpdb results in the error message

ImportError: No module named site

My problem seems similar to what is discussed in Running wxPython 2.9 on OS X 10.8 (64 bit), but the solution there does not seem to be applicable, as I don't seem to have anything like /Library/Frameworks/EPD64.framework/..., i.e. any Framework connected to Canopy or EPD


回答1:


This is a known issue which has been fixed for the next release of Canopy (coming soon.) In the meantime you should be able to workaround the issue by editing the 1st line in the winpdb script and setting it to use pythonw command instead of python. For example, change this line:

#!/Users/<UserId>/Library/Enthought/Canopy_64bit/User/bin/python

to:

#!/Users/<UserId>/Library/Enthought/Canopy_64bit/User/bin/pythonw


来源:https://stackoverflow.com/questions/23566181/running-winpdb-from-within-enthought-canopy-on-macos-10-9-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!