algorhythm algorhythm - 6 months ago 67
Python Question

How to run Pip commands from CMD

As I understand, Python 2.7.9 comes with Pip installed, however when I try to execute a Pip command from CMD (Windows) I get the following error:

'pip' is not recognized as an internal or external command, operable program or batch file.

When I type
I do get the following, which suggests it has been installed correctly:

Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on win32

Type "help", "copyright", "credits" or "license" for more information.

I did however need to add some environmental variables to get the python part working on CMD:

  • Add to the environment variable

  • Define the system variable

I cannot find a Pip folder within the Python directory, however there is a folder called "ensurepip" in

Does anybody know how can I get Pip commands to start working in CMD?


To execute Pip, first of all make sure you have it, so type in your CMD:

> python
>>> import pip

And it should proceed with no error. Otherwise, if this fails, you can look here to see how to install it. Now that you are sure you've got Pip, you can run it from CMD like this:

> python -m pip <command> <args>

Where <command> is any Pip command you want to run, and <args> are its relative arguments, separated by spaces.

For example, to install a package:

> python -m pip install <package>

Where <package> is the name of the package you want to install.