pip not working on windows python 2.7.9

2019-02-13 18:05发布

问题:

I've installed Python 2.7.9, which comes with already bundled with pip. I've check that it's there in the modules list. But when I run pip install I get SyntaxError: invalid syntax

With install highlighted as the error?

What am I doing wrong?

回答1:

Seems like you are running pip install from Python interactive console. Instead, you should run it from Windows console (cmd or PowerShell):

python2.exe -m pip install <package_name>

Where python2.exe is executable for Python2.7.9 (you may need to include full path to the executable file) and <package_name> is the name of package you want to install



回答2:

Append C:\Python27\Scripts;in PATH variable

where C:\Python27\Scripts; is the path where pip script is located.



回答3:

I faced the same issue and got to know that the error is because it is not able to find the pip.exe to execute. You need to check the path : C:\Python27\Scripts There, you will find the .exe file and if you run the command from that folder, the command should not give you the error or while running the command, please provide entire path instead of just pip command.



回答4:

just put python before pip

python pip install <package_name>


回答5:

To install try the following command:

python.exe -m install web.py


回答6:

what i would suggest is navigate to the location where pip is located and try with the following command : Pip install enter image description here



回答7:

Probably you want to install Python Modules? I really did many tries, So Finally reached on point to install Python3.6. It offers most easiest way to install it's modules, Try this way https://stackoverflow.com/a/46652413/8145641



回答8:

Soon's anwser worked for me, with slight difference, without 2 after python:

python.exe -m pip install <package_name>

What I don't understand, is that this should be equal to the command in interactive console as following, isn't it ?

pip -m install <pachage_name>