Python pip/easy_install 失败:无法创建进程

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

pip/easy_install failure: failed to create process

pythonpipeasy-install

提问by Matt

After following this article: How do I install pip on Windows?on my Windows system using Enthought Canopy 64 Bit system, I cannot get pip or easy_install to work due to error:

遵循这篇文章:如何在 Windows 上安装 pip?在我使用 Enthought Canopy 64 位系统的 Windows 系统上,由于错误,我无法让 pip 或 easy_install 工作:

pip install requests
failed to create process

I tried re-installing setuptools, running cmd prompt as admin without any effect.

我尝试重新安装 setuptools,以管理员身份运行 cmd prompt 没有任何效果。

采纳答案by 410 gone

When I encountered this, it was because I'd manually renamed the directory python was in. This meant that both setuptools and pip had to be reinstalled. Or, I had to manually rename the python directory to what it had been previously.

当我遇到这个时,是因为我手动重命名了python所在的目录。这意味着必须重新安装setuptools和pip。或者,我必须手动将 python 目录重命名为以前的名称。

回答by mfiers

If you intentionally want to rename the folder where python.exe resides, you should also modify all python files in the Scripts folder. So a third solution would be to modify the python files as well: the first line in pip-2.7-script.py originally contain:

如果有意重命名 python.exe 所在的文件夹,还应修改 Scripts 文件夹中的所有 python 文件。所以第三个解决方案是修改 python 文件:pip-2.7-script.py 中的第一行最初包含:

#!C:\OriginalPythonDir\python.exe

Modifying this path to the new Python folder fixes the problem.

将此路径修改为新的 Python 文件夹可解决此问题。

(P.S. Unfortunately I cannot yet reply to answers, so I'll reply as a new answer because I thought it could be useful for other people as well).

(PS 不幸的是我还不能回复答案,所以我会回复一个新的答案,因为我认为它对其他人也有用)。

回答by neeljpatel

I had installed Anaconda and so I still had C:\Python27 along with C:\Anaconda in my path. When I removed C:\Python27 and all subfolders I was able to use pip again.

我已经安装了 Anaconda,所以我的路径中仍然有 C:\Python27 和 C:\Anaconda。当我删除 C:\Python27 和所有子文件夹时,我能够再次使用 pip。

回答by PenguinJunk

I just use python in the command shell on Windows 7 and had this problem immediately after installing pip. In case the above solutions don't help you, you should check that the folder that pip.exe is installed in (in my case, the Script folder under Python32) is in the Path.

我只是在 Windows 7 的命令 shell 中使用 python,并且在安装 pip 后立即遇到了这个问题。如果上述解决方案对您没有帮助,您应该检查安装 pip.exe 的文件夹(在我的情况下,Python32 下的 Script 文件夹)是否在 Path 中。

回答by Sibi Chakkarvarthy S

Check whether the pip-script points out the exact location of python.exe, because pip always points (C:\python3.3\python.exe). In my system i've installed 2 versions of python i.e python2 & python3. I ve modified the home application of python.exe into python2.exe and python3.exe.

检查pip-script是否指出python.exe的确切位置,因为pip总是指向(C:\python3.3\python.exe)。在我的系统中,我安装了 2 个版本的 python,即 python2 和 python3。我已经将python.exe的home应用修改为python2.exe和python3.exe。

When i installed pip windows installer. it results me out with the error " failed to create process"

当我安装 pip windows installer 时。它导致我出现错误“无法创建进程”

回答by Mike P

When I came across this problem, I found that my path contained multiple entries for Python. After tidying up my path so that it had an entry for the python installation folder and the scripts folder (in my case C:\Python27and C:\Python27\Scripts), pip worked properly.

当我遇到这个问题时,我发现我的路径包含多个 Python 条目。在整理我的路径以使其具有 python 安装文件夹和脚本文件夹(在我的情况下C:\Python27C:\Python27\Scripts)的条目后,pip 正常工作。

回答by Joe

Just ran into this. Sort of. Pip worked for me, but after installing pytest-watch, running the ptwscript was giving this error.

刚碰到这个。有点。Pip 为我工作,但在安装pytest-watch 后,运行ptw脚本会出现此错误。

For some reason, pip stopped quoting the #! in ptw-script.py:

出于某种原因,pip 停止引用 #! 在ptw-script.py

#!C:\Program Files (x86)\Python\python.exe

It worked after I added quotes manually:

在我手动添加引号后它起作用了:

#!"C:\Program Files (x86)\Python\python.exe"

I don't really know why this suddenly started happening. Adding this here in case anyone else coming here from Google runs into the same thing.

我真的不知道为什么这突然开始发生。在这里添加这个以防万一从谷歌来到这里的其他人遇到同样的事情。

Here's a related pip issue(I think).

这是一个相关的 pip 问题(我认为)。

回答by logical8

It will help after changing the PATH to python in environment variables:

在环境变量中将 PATH 更改为 python 后会有所帮助:

python -m pip install --upgrade pip --force-reinstall

python -m pip install --upgrade pip --force-reinstall

回答by wang xu

Please check out have you ever rename your python.exe I install python2 and python3 on my PC at the same time , so I rename my python.exe to python3.exe.And when I use pip ,it boom... After rename it back .It's ok again....

请检查你有没有重命名你的 python.exe 我同时在我的电脑上安装了 python2 和 python3,所以我将我的 python.exe 重命名为 python3.exe。当我使用 pip 时,它会爆炸......重命名后回来。又没事了....

回答by worc

I ran into this bug while installing an older version of Python (3.5.2) for compatibility with some aws-adfsscripting. I installed aws-adfs with pip, on Windows 10, and found that while Python is installed to a directory path with spaces in it you will get the failed to create processerror.

为了与某些aws-adfs脚本兼容,我在安装旧版本的 Python (3.5.2) 时遇到了这个错误。我在 Windows 10 上使用 pip 安装了 aws-adfs,发现当 Python 安装到包含空格的目录路径时,您会收到failed to create process错误消息。

The pip maintainers say that it was a deeper problem with setuptools and even offered a workaround if you want to patch the installation in place.

pip 维护者说这是 setuptools 的一个更深层次的问题,甚至提供了一种解决方法,如果您想就地修补安装

But another, easier solution if you're working with older versions of Python is just to reinstall Python to a directory without spaces.

但是,如果您使用的是旧版本的 Python,另一个更简单的解决方案是将 Python 重新安装到没有空格的目录中。