Python:无法识别 Pip 命令

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12878615/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 12:04:35  来源:igfitidea点击:

Python: Pip command is not recognized

pythonpython-2.7pip

提问by Mazvél

Here is a screenshot I took.

这是我截取的截图。

enter image description here

在此处输入图片说明

When I try to use pipin command prompt I get the following error message: pipis not recognized as an internal or external command, operable program or batch file.

当我尝试pip在命令提示符中使用时,我收到以下错误消息: pip未被识别为内部或外部命令、可运行的程序或批处理文件。

I already checked this thread: How do I install pip on Windows?

我已经检查了这个线程:如何在 Windows 上安装 pip?

All I could find there was I had to add "C:\PythonX\Scripts"to my classpath, where Xstands for python version.

我所能找到的只是我必须添加"C:\PythonX\Scripts"到我的类路径中,其中X代表 python 版本。

As you can see on my screenshot I already have this path. I already tried restarting the computer but that didn't work, o.O. The screenshot also shows my C:\Python27\Scriptsfolder.

正如您在我的屏幕截图中看到的,我已经有了这条路径。我已经尝试过重新启动计算机,但是没有用,oO 屏幕截图还显示了我的C:\Python27\Scripts文件夹。

Does anyone know what I am doing wrong?

有谁知道我做错了什么?

采纳答案by Mazvél

There is a space before the last path entry, right after the previous semicolon, that is causing the problem.

在最后一个路径条目之前有一个空格,就在前一个分号之后,这是导致问题的原因。

回答by Бранко Или?

It started working for me when I added ; in PATHEXT after .PY

当我添加时,它开始为我工作;在 .PY 之后的 PATHEXT 中

回答by arvind kumar

Go to C:\Python27\Scripts

C:\Python27\Scripts

Now select the url bar and replace whole content with cmd

现在选择网址栏并将整个内容替换为 cmd

This way you directly reach to the directory where pip is available in command prompt

这样你就可以直接到达命令提示符中 pip 可用的目录

Now type pip install Django==1.8.5it will download and install Djanog

现在输入 pip install Django==1.8.5它将下载并安装 Djanog

回答by syed zayed

1) browse here - C:\Python27\Scripts
2) open the cmd window/terminal (shift+'right click')
3) type pip install django

1) 浏览这里 - C:\Python27\Scripts
2) 打开 cmd 窗口/终端 (shift+'右键单击')
3) 输入pip install django

回答by magnetar

I had the same exact problem, but typing your command inthe "Scripts" folder fixed it!

我遇到了同样的问题,但“脚本”文件夹中输入您的命令修复了它!

In other words:

换句话说:

  1. Open command prompt (right click windows start menu and click on "Command Prompt (Admin)"
  2. Use "cd" command to change directory to where python is installed, but go to your scripts folder (for me, this is cd C:\Program Files\PythonXX\Scriptswhere the XX is the version number of Python)
  3. Once in "Scripts" folder, type pip install cythonand press enter
  1. 打开命令提示符(右键单击 Windows 开始菜单,然后单击“命令提示符(管理员)”)
  2. 使用“cd”命令将目录更改为安装python的位置,但转到您的脚本文件夹(对我来说,cd C:\Program Files\PythonXX\Scripts这里的XX是Python的版本号)
  3. 进入“Scripts”文件夹后,键入pip install cython并按回车键

回答by John

1) open cmd as an administrator

1)以管理员身份打开cmd

2) enter: cd c:\python27\scripts (go to python and shift right click on folder. Than copy to path)

2)输入:cd c:\python27\scripts(转到python并右键单击文件夹。然后复制到路径)

3) press enter

3)按回车

4) pip install

4)pip安装

回答by kashfia rahman

  1. Add "your python path"\Scripts to PATH variable. See How to set path variable

  2. Don't forget to restart the command prompt.

  1. 将“您的 python 路径”\Scripts 添加到 PATH 变量。请参阅如何设置路径变量

  2. 不要忘记重新启动命令提示符。

Now pip will work in any path.

现在 pip 可以在任何路径中工作。

回答by user11427743

Go to your Python Script Path, copy the path, go to CMD and type cd "paste the path you copied".

转到您的 Python 脚本路径,复制路径,转到 CMD 并键入 cd“粘贴您复制的路径”。

type pip --version

输入 pip --version

You will see the version of pip your system is running.

您将看到系统正在运行的 pip 版本。

回答by Dip

  1. Check if you have python installed properly.

  2. next install pip using

  1. 检查您是否正确安装了python。

  2. 接下来安装 pip 使用

a) Download get-pip.pyto a folder on your computer.

a) 将get-pip.py下载到您计算机上的文件夹中。

b) Open a command prompt and navigate to the folder containing get-pip.py.

b) 打开命令提示符并导航到包含 get-pip.py 的文件夹。

c) Run the following command:

c) 运行以下命令:

python get-pip.py

Pip is now installed!

现在安装了 Pip!

  1. Copy the path of executable file in environment variable. It is the Script folder path where python is installed. like C:Programs\Python\Python35-32\Scripts OR C:\Users(username)\AppData\Local\Programs**\Python\Python35-32\Scripts**

  2. Restart your command prompt and its done

  1. 将可执行文件的路径复制到环境变量中。它是安装python的脚本文件夹路径。像 C:Programs\Python\Python35-32\Scripts 或 C:\Users(username)\AppData\Local\Programs**\Python\Python35-32\Scripts**

  2. 重新启动命令提示符并完成