pip not working on windows python 2.7.9

2019-02-13 17:51发布

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?

8条回答
叼着烟拽天下
2楼-- · 2019-02-13 18:25

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>
查看更多
迷人小祖宗
3楼-- · 2019-02-13 18:30

Append C:\Python27\Scripts;in PATH variable

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

查看更多
Evening l夕情丶
4楼-- · 2019-02-13 18:33

just put python before pip

python pip install <package_name>
查看更多
冷血范
5楼-- · 2019-02-13 18:33

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

查看更多
不美不萌又怎样
6楼-- · 2019-02-13 18:37

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.

查看更多
放荡不羁爱自由
7楼-- · 2019-02-13 18:40

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

查看更多
登录 后发表回答