python pip install在Windows上不起作用 [英] python pip install not working on windows
问题描述
我在Windows上安装了python 2.7.10,并且尝试使用以下命令在命令行上安装Django:
I have python 2.7.10 installed on windows and I am trying to install Django on the commandline with the following command:
C:/users/user/myproject> python pip install django
这将显示以下错误:
python: can't open file 'pip' [Errno 2] No such file or directory
Python已安装在C:\Python27
中,并且PATH
环境变量也已设置为该变量.
Python is installed in C:\Python27
and the PATH
environment variable is also set to that.
为什么点子不起作用?
推荐答案
Since Python 2.7.9 pip
is included when python is installed.
但是python安装的scripts
子文件夹可能未添加到PATH
环境变量中,因此仅通过键入pip install
就无法访问.但是,只要您的python
可执行文件在路径上,,您就可以使用pip
模块作为脚本执行
However the scripts
subfolder of your python installation might not be added to your PATH
environment variable, and hence inaccessible by just typing pip install
. However as long as your python
executable is on the path, you can use the python -m
flag to execute the pip
module as a script:
python -m pip install SomePackage
只要PATH
位于PATH
上,它就可以从命令行运行.
This should work from the command line as long as python
is on PATH
.
如果您想直接从cmd.exe
提示符下使用pip
,则需要将scripts
目录添加到您的PATH
环境变量中:
If you would like to use pip
directly from the cmd.exe
prompt you need to add the scripts
directory to your PATH
environment variable:
SET PATH=%PATH%;C:\Python27\scripts
这篇关于python pip install在Windows上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!