Reputation: 21063
Attempting to run runsnake gives
ImportError: No module named wx
Opening an ipython or python session seems to work fine:
>>> import wx
>>> import sys
>>> print [p for p in sys.path if 'wx' in p]
['/usr/local/lib/wxPython-2.9.4.0/lib/python2.7/site-packages', '/usr/local/lib/wxPython-2.9.4.0/lib/python2.7/site-packages/wx-2.9.4-osx_cocoa', '/usr/local/lib/wxPython-2.9.4.0/lib/python2.7/site-packages/wx-2.9.1-osx_cocoa/tools']
as does putting that code in a script and calling python script.py
. But putting that code at the beginning of runsnake.py
prints an empty list (printing the whole sys.path
prints a path quite different from my $PYTHONPATH).
Why would it be different, and how to I get it to recognize wxPython?
Edit: pip freeze
output contains
SquareMap==1.0.1
RunSnakeRun==2.0.2b1
wxPython==2.9.4.0
wxPython-common==2.9.4.0
Upvotes: 3
Views: 908
Reputation: 8516
Try running runsnake outside of a virtualenv.
See detailed reasons here: http://wiki.wxpython.org/wxPythonVirtualenvOnMac
Upvotes: 0
Reputation: 24304
runsnake.py
and the python interpreter in the same virtualenv
? If not you will not have the same packages.runsnake.py
in a virtual environment constructed with --no-site-packages
, you will not have access to system-wide packages. Running pip freeze
will tell you if you have access to wxPython
. If you don't then that's the issue. You can create a new virtualenv
properly.virtualenv
command?#!/usr/bin/python
or #!/usr/bin/env python
python runsnake.py
For Framework build of python on OSX, please see this question.
Upvotes: 1