【发布时间】:2014-07-05 17:03:08
【问题描述】:
尝试在我的计算机上安装 Django 时遇到了一个奇怪的错误。
这是我在命令行中输入的序列:
C:\Python34> python get-pip.py
Requirement already up-to-date: pip in c:\python34\lib\site-packages
Cleaning up...
C:\Python34> pip install Django
'pip' is not recognized as an internal or external command,
operable program or batch file.
C:\Python34> lib\site-packages\pip install Django
'lib\site-packages\pip' is not recognized as an internal or external command,
operable program or batch file.
这可能是什么原因造成的?
这是我输入echo %PATH%时得到的:
C:\Python34>echo %PATH%
C:\Program Files\ImageMagick-6.8.8-Q16;C:\Program Files (x86)\Intel\iCLS Client\
;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\S
ystem32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\
Windows Live\Shared;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Progr
am Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Intel\Intel(R) Mana
gement Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine C
omponents\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components
\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\P
rogram Files (x86)\nodejs\;C:\Program Files (x86)\Heroku\bin;C:\Program Files (x
86)\git\cmd;C:\RailsInstaller\Ruby2.0.0\bin;C:\RailsInstaller\Git\cmd;C:\RailsIn
staller\Ruby1.9.3\bin;C:\Users\Javi\AppData\Roaming\npm
【问题讨论】:
-
您可能需要将 pip 添加到 PATH 环境变量中。否则 CMD 提示符不知道你在说什么
-
嗯,我对编程比较陌生,只在 Rails 上做过一些 ruby。你能解释一下PATH环境变量是什么意思吗?怎么样?
-
@fr1tz 我得到了一个巨大的输出...看起来真的很长的文件目录
-
@user3597960 你知道你的 pip 安装位置吗?您需要将此位置添加到非常长的目录列表中,这实际上是 PATH 系统变量。要将其添加到 PATH 变量中,您可以使用
setx PATH "%PATH%;C:\pip"例如,也可以通过控制面板添加它 -
如果你的 Python\Python37-32\Scripts 的路径太长,比如我的 C:\Users\IT-admin\AppData\Local\Programs\Python\Python37-32\Scripts 那么命令终端修剪路径,不允许添加完整路径。在这种情况下,使用控制面板中的“高级系统设置”手动添加,如下面答案中@KarthikeyanVK 的屏幕截图所示