我无法为 python 安装“pip”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27545244/
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-19 01:56:40  来源:igfitidea点击:

I can't install 'pip' for python

pythonwindowspython-2.7powershellpip

提问by Lagastic

I'm going trough the book Learn Python The Hard Way and i need to install pip.(ex46,ex47) So i saved get-pip.pyon my computer and in powershell i did :

我正在阅读《Learn Python The Hard Way》这本书,我需要安装 pip。(ex46,ex47) 所以我在我的电脑上保存了get-pip.py并在 powershell 中我做了:

PS C:\Users\Toto\pip> python Get-pip.py
Downloading/unpacking pip
Installing collected packages: pip
Successfully installed pip
Cleaning up...

but then when i try: PS C:\Users\Toto\pip> pip

但是当我尝试: PS C:\Users\Toto\pip> pip

i get this error: pip : The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the s pelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + pip + ~~~ + CategoryInfo : ObjectNotFound: (pip:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

我收到此错误: pip : The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the s pelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + pip + ~~~ + CategoryInfo : ObjectNotFound: (pip:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

C:\Python27\Scripts\ is already on my path.

C:\Python27\Scripts\ 已经在我的路径上。

I can't figure this out. If some one could please help me.

我想不通。如果有人可以请帮助我。

note: i'm on windows 8 and this is with python 2.7

注意:我在 Windows 8 上,这是使用 python 2.7

采纳答案by Mike Driscoll

Whenever I've installed pip on my Windows machine, it installs to my Python's Scripts folder:

每当我在 Windows 机器上安装 pip 时,它都会安装到我的 Python 的 Scripts 文件夹中:

c:\Python34\Scripts

So to get pip to run on the command line, I had to add that path to my PATH environment variable. You can get to those settings by doing the following (assuming Windows 7 or newer):

因此,为了让 pip 在命令行上运行,我必须将该路径添加到我的 PATH 环境变量中。您可以通过执行以下操作(假设使用 Windows 7 或更高版本)来访问这些设置:

  1. Right click My Computer and choose Properties
  2. Go to Advanced system settings
  3. Click on the Environment Variablesbutton
  4. Double-click the PATH (or Path) variable listed under System variables
  5. Add c:\Python34\Scriptsto the end of the list of other paths making sure that it is separated from the previous entry with a semi-colon
  1. 右键单击我的电脑并选择 Properties
  2. 进入高级系统设置
  3. 点击Environment Variables按钮
  4. 双击下面列出的 PATH(或路径)变量 System variables
  5. 添加c:\Python34\Scripts到其他路径列表的末尾,确保它与前一个条目用分号隔开

Restart your shell and try running pip. If it still doesn't work, you need to find out where pip got installed. In my Scripts folder, I have a pip.exefile. If you do not, then adding the Scriptsfolder to your path won't help. You'll have to figure out where it got installed and add that path instead.

重启你的 shell 并尝试运行 pip。如果它仍然不起作用,您需要找出pip安装的位置。在我的 Scripts 文件夹中,我有一个pip.exe文件。如果不这样做,则将该Scripts文件夹添加到您的路径将无济于事。您必须弄清楚它的安装位置并添加该路径。

回答by hasan zafar

You can copy zklib in the odoo server folder and restart the odoo server and it should work.

您可以将 zklib 复制到 odoo 服务器文件夹中并重新启动 odoo 服务器,它应该可以工作。

回答by Rami Salim

For windows users If the above solution does not help then make sure your python folder is in the right place to do so, go to the windows search bar and type python then right-click open location folder and copy the path and paste it in the environment variables

对于 Windows 用户 如果上述解决方案没有帮助,请确保您的 python 文件夹位于正确的位置,请转到 Windows 搜索栏并键入 python,然后右键单击打开位置文件夹并复制路径并将其粘贴到环境变量

for more explanation check the following [link ]: https://www.youtube.com/watch?v=i4yJi-cpwWk

有关更多解释,请查看以下 [链接]:https: //www.youtube.com/watch?v=i4yJi-cpwWk