[Solved] pip: command not found

I encounter a problem when installing pip for python2.7. I downloaded the file, and install it successfully:

bogon:haha itensb$ python
Requirement already up-to-date: pip in /Library/Python/2.7/site-packages
Cleaning up...

But when I run the command pip, I got:

-bash: pip: command not found

I think it is the PATH not set appropriatelly , But I new on Mac. I need your help , thanks!

Enquirer: itenyh

Solution #1:

Use python -m pip. If you want the pip command check out @user3282276’s answer.

Respondent: TheInitializer
Solution #2:

Sounds like your PATH variable is not set to include the location that pip was installed to. On Macs and other *nix like operating systems when you type a command in the command line, what is actually happening is the shell is trying to find the executable file in a predefined area, called the PATH variable. If you are interested check out this question,

You are able to see what yours is set to if you do this in your command line

echo $PATH

this will give you some file paths separated by colons, for example when I type the command above I get this:

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/Applications/Android Dev Tool/sdk/tools

which means that my shell will check for a executable in each of these files, if it finds it, it will run otherwise it will tell you the program can’t be found. As a side note this is the reason why when you run an executable not in one of these PATH files you must do,


this is specifying a relative path to the executable file, the current directory that you are in.

So for you, you installed pip to this directory:


chances are the above echo statement did not include this file, if it did then you have another problem. What you need to do is to update your PATH variable to include this directory as well.

To do this you add an export statement to your .bash_profile (or .bashrc on Linux) in your home directory (this is a hidden file) that includes your current path variables (so you will still be able to run everything installed in the proper place) and this new directory that you installed pip to. To do this add this line to the end of your .bash_profile

export PATH=${PATH}:/Library/Python/2.7/site-packages

and you should be good to go. However before it will take effect you need to close and open your terminal window again or run source .bash_profile. You can verify this worked by running the echo command above, it should return the same thing but this time with /Library/Python/2.7/site-packages appended to the end.

Note: By the way the which command that you were told to run in the comments locates a program within the users path, which is why it did not return anything to you. Also since you will probably run into this soon enough there is also a variable called PYTHONPATH (look here) which tells python where to look to import modules. You should set this to whatever directory you have pip installing modules to if it is not already set.

Respondent: user3282276
Solution #3:

Install python3 first, then use pip3 to install packages.

brew install python

python3 will be installed, and pip is shipped with it. To use pip to install some package, run the following

pip3 install package

Notice it’s pip3 because you want to use python3.

My same answer here

Respondent: N.Lee
Solution #4:

to run the command, it works

sudo easy_install pip
Respondent: Java Basketball
The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Most Popular

To Top
India and Pakistan’s steroid-soaked rhetoric over Kashmir will come back to haunt them both clenbuterol australia bossier man pleads guilty for leadership role in anabolic steriod distribution conspiracy