python 2.7: cannot pip on windows "bash: pip: command not found"
As long as pip lives within the scripts folder you can run
python -m pip ....
This will tell python to get pip from inside the scripts folder. This is also a good way to have both python2.7 and pyhton3.5 on you computer and have them in different locations. I currently have both python2 and pyhton3 installed on windows. When I type python
it defaults to python2. But if I type python3
I can use python3. (I also had to change the python.exe file for python3 to "python3.exe")If I need to install flask for python 2 I can run
python -m pip install flask
and it will be installed in the pyhton2 folder, but if I need flask for python 3 I run:
python3 -m pip install flask
and I now have it in the python3 folder
On Windows, pip
lives in C:\[pythondir]\scripts
.
So you'll need to add that to your system path in order to run it from the command prompt. You could alternatively cd
into that directory each time, but that's a hassle.
See the top answer here for info on how to do that: Adding Python Path on Windows 7
Also, that is a terrifying way to install pip
. Grab it from Christophe Gohlke. Grab everything else from there for that matter.
http://www.lfd.uci.edu/~gohlke/pythonlibs/
I found this much simpler. Simply type this into the terminal:
PATH=$PATH:C:\[pythondir]\scripts
- press
[win] + Pause
- Advanced settings
- System variables
- Append
;C:\python27\Scripts
to the end ofPath
variable - Restart console