Python Pip - 启动器中的致命错误:无法使用 '"' 创建进程

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

Pip - Fatal error in launcher: Unable to create process using '"'

pythonwindowspython-3.xpipampps

提问by rinderwahn

I installed python 3.5.1 via ampps and it's working. However, when i try to use pip, i get the following message:

我通过 ampps 安装了 python 3.5.1 并且它正在工作。但是,当我尝试使用 pip 时,我收到以下消息:

Fatal error in launcher: Unable to create process using '"'

I already reinstalled ampps into a path which doesn't include any whitespaces. Note that the "python -m pip" workaround doesn't work for me too, since i get the following message everytime i use it:

我已经将 ampps 重新安装到不包含任何空格的路径中。请注意,“python -m pip”解决方法对我也不起作用,因为我每次使用它时都会收到以下消息:

C:\Users\MyUserName\Desktop\Ampps\python\python.exe: Error while finding spec for 'pip.__main__' (<class 'ImportError'>: No module named 'queue'); 'pip' is a package and cannot be directly executed

How do i get pip to work properly? I hope, there is a way to use the pip command itself without the preceding python command.

我如何让 pip 正常工作?我希望有一种方法可以在没有前面的 python 命令的情况下使用 pip 命令本身。

EDIT: This is what happens, if i try to run python -c "import pip.__main__":

编辑:这就是发生的情况,如果我尝试运行python -c "import pip.__main__"

Traceback (most recent call last):
  File "C:\Users\MyUserName\Desktop\Ampps\python\lib\site-packages\pip\compat\__init__.py", line 11, in <module>
    from logging.config import dictConfig as logging_dictConfig
  File "C:\Users\MyUserName\Desktop\Ampps\python\lib\logging\config.py", line 30, in <module>
    import logging.handlers
  File "C:\Users\MyUserName\Desktop\Ampps\python\lib\logging\handlers.py", line 28, in <module>
    import queue
ImportError: No module named 'queue'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\MyUserName\Desktop\Ampps\python\lib\site-packages\pip\__init__.py", line 13, in <module>
    from pip.utils import get_installed_distributions, get_prog
  File "C:\Users\MyUserName\Desktop\Ampps\python\lib\site-packages\pip\utils\__init__.py", line 18, in <module>
    from pip.compat import console_to_str, stdlib_pkgs
  File "C:\Users\MyUserName\Desktop\Ampps\python\lib\site-packages\pip\compat\__init__.py", line 13, in <module>
    from pip.compat.dictconfig import dictConfig as logging_dictConfig
  File "C:\Users\MyUserName\Desktop\Ampps\python\lib\site-packages\pip\compat\dictconfig.py", line 22, in <module>
    import logging.handlers
  File "C:\Users\MyUserName\Desktop\Ampps\python\lib\logging\handlers.py", line 28, in <module>
    import queue
ImportError: No module named 'queue'

采纳答案by rinderwahn

I fixed my issue by...

我通过...解决了我的问题

  1. downloading Python 3 at the official website and installing it via express installation
  2. Copy & Paste the standalone python into the ampps/python folder and overwriting the python version provided by AMPPS
  3. running python -m pip install --upgrade pipin cmd
  1. 在官网下载Python 3并通过快速安装进行安装
  2. 将独立的python复制并粘贴到ampps/python文件夹中并覆盖AMPPS提供的python版本
  3. python -m pip install --upgrade pip在cmd中运行

Now pip and python 3 are installed in their latest version.

现在 pip 和 python 3 安装在它们的最新版本中。

It seems that AMPPS doesnt't provide a full-fledged python build. So you need to update python yourself.

AMPPS 似乎没有提供成熟的 python 构建。所以你需要自己更新python。

Thanks to y'all.

谢谢你们。

回答by RolfBly

The same error, but in a different situation. I have a virtual environment, in which I ran, in the VE's \Scriptsdirectory where pip.exeis:

同样的错误,但在不同的情况下。我有一个虚拟环境,我在其中运行,在 VE 的\Scripts目录中pip.exe

pip freeze

I got the error message

我收到错误信息

Fatal error in launcher: Unable to create process using '"'

There is no space in my VE path (google that error). Then I tried python -m pip install --upgrade pipand got

我的 VE 路径中没有空格(谷歌那个错误)。然后我尝试python -m pip install --upgrade pip并得到

Requirement already up-to-date: pip in o:\upsdowns\flask\lib\site-packages

so then I tried

所以我试过了

python -m pip freeze

and that worked. I think it might be a path issue in the VE, but I'm OK with this workaround.

这奏效了。我认为这可能是 VE 中的路径问题,但我对这个解决方法没意见。

I'm adding this here because this page is high up when you google that errormessage. In other words, I didn't make a new question, even though my situation is quite different from the OP's. Possibly even, I got into that situation because I didn't add modules to the virtual environment "properly".

我在这里添加这个是因为当你谷歌那个错误消息时这个页面很高。换句话说,即使我的情况与 OP 的情况大不相同,我也没有提出新问题。甚至可能,我陷入这种情况是因为我没有“正确地”将模块添加到虚拟环境中。

Anyway, I hope it helps some.

无论如何,我希望它对一些人有所帮助。

回答by Tom E. O'Neil

I found a very simple solution to, (Pip - Fatal error in launcher:)

我找到了一个非常简单的解决方案,(Pip - 启动器中的致命错误:)

1) You must not have multiple environmental variables for the python path.

1)你不能有多个python路径的环境变量。

A) Goto Environmental Variables and delete Python27 in the path if you have Python 3.6.5 installed.  Pip is confused by multiple paths!!!

回答by hfz

run this python code:

运行这个python代码:

import pip
pip.main(['install','flask']) # replace flask with the name of module you want to install

If you need to install multiple modules from a requirements.txt file,

如果您需要从一个 requirements.txt 文件安装多个模块,

import pip
fo = open("C:/...../requirements.txt", "r")
inp = fo.read()
ls =inp.split()     

for i in ls:
    pip.main(['install',i])

回答by Antony Hatchkins

The fastest way is:

最快的方法是:

python -m pip install pip==9.0.0

If you want the latest pip, you can run

如果你想要最新的点子,你可以运行

pip install -U pip

afterwards.

然后。

回答by AzureSun

Checked the evironment path, I have two paths navigated to two pip.exe and this caused this error. After deleting the redundant one and restart the PC, this issue has been fixed. The same issue for the jupyter command fixed as well.

检查了环境路径,我有两个路径导航到两个 pip.exe,这导致了这个错误。删除多余的并重新启动PC后,此问题已得到修复。jupyter 命令的相同问题也已修复。

回答by Contango

This worked for me under Windows 10 x64:

这对我有用Windows 10 x64

Ensure that the Python directories are in the path, e.g.:

确保 Python 目录在 path 中,例如:

# Edit Environment variables so that variable "path" points to the new location.
# Insert these at the start of the list (or delete other Python directories), as Windows takes the first match it finds.
# Run the program "Edit the System Environment Variables".
# Or see Control Panel under "System Properties".
S:\Research\bin\Python375\Scripts\
S:\Research\bin\Python375\

Then:

然后:

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

In my particular case, the error was caused by shifting the Python directory to a new location.

在我的特殊情况下,错误是由将 Python 目录移动到新位置引起的。

回答by Bhoopendra Kumar Sharma

One more very basic and simple solution. Run the related python version's installation file (setup file) and click repair mode. It hardly takes one-two minutes and everything works perfectly after that :)

另一种非常基本和简单的解决方案。运行相关python版本的安装文件(setup文件),点击修复模式。几乎不需要一两分钟,之后一切正常:)

回答by Baishan Lu

I got the same error when installed both python2 and python3 on my Windows 7.

在 Windows 7 上同时安装 python2 和 python3 时,我遇到了同样的错误。

You can use python3 -m pip install xxxxxxto install your package.

您可以使用python3 -m pip install xxxxxx来安装您的软件包。

Or, fix it completely:

或者,完全修复它:

  1. Try to run python3 -m pip install --upgrade pipin cmd.

  2. If failed in step 1, try python3 ?-m pip install --upgrade --force-reinstall pip

  1. 尝试python3 -m pip install --upgrade pip在cmd中运行。

  2. 如果在步骤 1 中失败,请尝试 python3 ?-m pip install --upgrade --force-reinstall pip

回答by Juan Casta?o

It happened to me using pip package, then I solved it like below:

它发生在我使用 pip 包,然后我解决它如下:

1) First of all uninstall pip using python command

1)首先使用python命令卸载pip

$python -m pip uninstall pip

2) Then reinstall pip package using easy_install command

2)然后使用easy_install命令重新安装pip包

$easy_install pip

3) Finally, try again pip command on command line directly, install any package

3)最后,直接在命令行中再次尝试pip命令,安装任何包

$pip install pylint

or only execute pip command

或者只执行 pip 命令

$pip