Installing pip on OS X without sudo

Without administrator privledges, it may not be possible to install the Python package manager, pip, using the default method:

python get-pip.py

In this case, pip can be installed in the user’s home folder using:

python get-pip.py --user

This installs pip in the site.USER_BASE/bin directory. But where is this? To find out, open python, import the site module, and extract the USER_BASE variable:

python
 >>> import site
 >>> print(site.USER_BASE)
 /Users/jgalazka/Library/Python/2.7

Thus, in this case, pip is installed in /Users/jgalazka/Library/Python/2.7/bin. Add this directory to your path and test your install:

pip --help

When you use pip, remember to include the —user option:

pip install --user

Credit to Ramesh Nethi:
https://forcecarrier.wordpress.com/2013/07/26/installing-pip-virutalenv-in-sudo-free-way/

Credit to Richard Michael:
https://github.com/pypa/pip/issues/3027

Leave a comment