I have an issue with Python on my Mac with High Sierra.
After running pip install pysal
, I have a successful installation. However, the module is not found when I run in python
:
> import pysal
Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named pysal
I do not face such errors when running the same command in python2
. However, most of my python scripts call the interpreter at the beginning of the file with #!/usr/bin/env python
, so I would prefer not having to rely on python2 (I don't know how to do it either).
I figured out that this is python's executable is not on the same location where pip installs the modules:
macbook-pro-3:~ ME$ which -a python
/usr/bin/python
macbook-pro-3:~ ME$ which -a pip
/usr/local/bin/pip
I tried to follow the solution proposed by @J0ANMM in Modules are installed using pip on OSX but not found when importing . It recommeds downloading the script get-pip.py and executing it with sudo /usr/bin/python get-pip.py
. I tried, but it did not change anything (the previous which
commands still yield the same thing).
How do I manage to make pip
work with my version of python?