I generally use IPython and only recently noticed that the the search path for imports is wrong in the regular python shell. From what I understand, sys.path inherits from P
Probably too late for you now, but the answer here may help you too: ipython reads wrong python version . Basically the ipython script can directly reference a specific python binary rather than the one that you'd get if you just ran python directly.
I had a brew installed version of Python on my mac. For some reason that couldn't use the system libraries. After brew uninstall python
it worked again, because the default python was switched back to /usr/bin/python.
Also playing around with which python
, which ipython
and opening up /usr/bin/python, /usr/local/bin/python, /usr/bin/ipython and /usr/local/bin/ipython and doing the imports there might help you find out where it is exactly going wrong.
You may have your virtual environment activated which is ignoring the system path.
It can be fixed by running this in terminal (After closing notebook etc):
virtualenv --system-site-packages ~