Python pip 未被识别为内部或外部命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/48572380/
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
pip not recognised as an internal or external command
提问by KardasR
I want to install Pillow for Python 3.6 but I'm having trouble installing it. I'm on their installation page, https://pillow.readthedocs.io/en/latest/installation.htmland all they say to download is "pip install Pillow" and nothing else. So I tried to type that in my command prompt and all I get is, 'pip' is not recognized as an internal or external command, operable program or batch file. So obviously I'm missing something.
我想为 Python 3.6 安装 Pillow,但在安装时遇到问题。我在他们的安装页面上,https://pillow.readthedocs.io/en/latest/installation.html,他们说要下载的只是“pip install Pillow”而已。所以我试图在我的命令提示符中输入它,但我得到的只是,'pip' 不是内部或外部命令,也不是可运行的程序或批处理文件。所以显然我错过了一些东西。
回答by Garuda
If you are using windows then go to C: and search for python. A folder with user version number will be shown like 'Python37'. Open the folder and you'll see a folder named Scripts, open that, then you'll find pip.exe. Now copy the folder path and open 'Edit the system environment variables' in control panel. In that click on Environmental Variables and you'll something called path. Select path and click on edit, a window pops up, in that click and new and paste the directory address you copied previously. Save and exit everything. Now open cmd and type pip install [whatever].
如果您使用的是 Windows,则转到 C: 并搜索 python。带有用户版本号的文件夹将显示为“Python37”。打开文件夹,你会看到一个名为 Scripts 的文件夹,打开它,然后你会找到 pip.exe。现在复制文件夹路径并在控制面板中打开“编辑系统环境变量”。在那个点击环境变量,你会得到一个叫做路径的东西。选择路径并单击编辑,弹出一个窗口,在该窗口中单击并新建并粘贴您之前复制的目录地址。保存并退出所有内容。现在打开 cmd 并输入 pip install [whatever]。
回答by Juan Pablo Marin
This command fixed my issue:
此命令解决了我的问题:
python -m ensurepip --default-pip
回答by sdgd
Try giving the complete path to pip -
尝试给出 pip 的完整路径 -
C:\Python27\Scripts\pip install <the library you want to install>
Example:
例子:
C:\Python27\Scripts\pip install numpy-1.14.0-cp27-none-win_amd64.whl
or give the path to library you want to install as well.
或者给出你想要安装的库的路径。
C:\Python27\Scripts\pip install C:\Python27\pillow
回答by KardasR
Okay so I solved the problem.
好的,所以我解决了这个问题。
I had to go into a terminal in my pyCharm, cd to a separate hard drive (Where I only store my work and games) then
我不得不在我的 pyCharm 中进入一个终端,然后将其 cd 到一个单独的硬盘驱动器(我只存储我的工作和游戏)
pip install Pillow
and it installed perfectly fine and I got it working. I didn't install or move anything at all either. I'm just now curious as to why it decided to work in an IDE terminal and not my own cmd prompt. Oh well
它安装得很好,我让它工作了。我也根本没有安装或移动任何东西。我现在很好奇它为什么决定在 IDE 终端而不是我自己的 cmd 提示符下工作。那好吧