Reputation: 353
I would like to install some Python libraries to the default Python 2.7.10 which is provided with OSX. Can I do that using pip?
Apparently now pip installs libraries in a different Python path: pip 9.0.1 from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (python 2.7)
The reason why I am asking this question is that I am using a program that can only use the built-in Python and that does not support virtualenv.
I have tried with sudo pip install packageX
, but I get "Requirement already satisfied" and if I run a Python script using the Automator or via /usr/bin/python, I keep getting "ImportError: No module named packageX".
I am running macOS 10.13.2.
Some more details: if I run type -a python
I get:
python is /Library/Frameworks/Python.framework/Versions/2.7/bin/python
python is /usr/local/bin/python
python is /usr/bin/python
While which python
returns:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
Upvotes: 2
Views: 2829
Reputation: 614
A bit lengthy but you could try calling pip via the full path:
sudo /usr/local/bin/pip install <module>
if this works then can reroute pip call in your bashrc?
Upvotes: 1
Reputation: 1829
If you install your library using sudo / root like this:
$ sudo pip install <library>
You should be able to access it globally. If this doesn't work, please update your question with the error you're getting.
Upvotes: 1