我在电脑上安装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

当前回答

小说明:在“Windows 7 64位PC”中,添加后…Python34\脚本到路径变量,pip安装pygame不适合我。

所以我检查了“…Python34\Scripts"文件夹,它没有pip,但它有pip3和pip3.4。所以我运行pip3.4 install pygame .... .whl。它工作。

(进一步在下载pygame的文件夹中打开一个命令窗口…whl文件。)

其他回答

尝试卸载Python,删除剩余的程序文件,然后重新安装。

这对我很管用。当我迁移到一台新的笔记本电脑并使用迁移软件将我的软件从旧笔记本电脑迁移到新的笔记本电脑时,我遇到了这个错误。是的,它的效果不太好。

进入控制面板>>卸载或更改程序,双击Python XXX修改安装。确保PIP组件被检查并安装。

解决这个问题的一个非常简单的方法是在文件资源管理器中打开pip安装的路径,然后单击该路径,然后键入cmd,这设置了路径,让你更容易安装。

几天前我遇到了同样的问题,所有其他的方法都对我不起作用。

如果你正在使用Python,例如PyCharm,你应该像这样将库安装到Python库路径:

pip install --target=C:\Users\<...>\lib <Library-Name>

真正的如。

pip install --target=C:\Users\devel\AppData\Local\Programs\Python\Python36\Lib requests <br>

PS:如果你想检查是否安装,

<Library-Name> --version

不能正常工作。

我的命令是:

set PATH=%PATH%;C:\Python34\Scripts

(在echo %PATH%之后尝试,你会看到你的路径值为C:\Python34\Scripts)。

Thanks to:在Windows环境变量PATH中添加一个目录