python-2.7pipsystem-paths

How do I make pip available from command line mac?


I'm trying to install pip for python and cannot seem to figure out how to make the scripts subdirectory of my python installation available on the system path. (I've already installed pip with easy_install)

According to the pip site this isn't done automatically:

"To enable the use of pip from the command line, ensure the Scripts subdirectory of your Python installation is available on the system PATH. (This is not done automatically.)"

I haven't found any straightforward tutorials on how to modify this.


Solution

  • First you need to find the path to your python installation, you can do this by typing this:

    which python
    

    In that directory there should be a directory called Scripts

    You can then add the full path of this directory to PATH by typing

    export PATH=$PATH:"<insert_path_here>"
    

    So for example mine was:

    export PATH=$PATH:"/cygdrive/c/Python27/Scripts"
    

    You are only appending the new path to PATH, not replacing the old one. Be very careful to add the $PATH: after the equals. This is what keeps the old PATH intact. The : is the path separator.