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
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