问题:启动器中的致命错误:无法使用“” C:\ Program Files(x86)\ Python33 \ python.exe”来创建进程。“ C:\ Program Files(x86)\ Python33 \ pip.exe”

搜索网络似乎是由Python安装路径中的空格引起的问题。

我如何pip才能工作而不必在没有空格的路径中重新安装所有内容?

Searching the net this seems to be a problem caused by spaces in the Python installation path.

How do I get pip to work without having to reinstall everything in a path without spaces ?


回答 0

看起来

python -m pip install XXX 

无论如何都会为我工作(请参阅user474491的链接

it seems that

python -m pip install XXX 

will work anyway (worked for me) (see link by user474491)


回答 1

至少在Windows上,pip将安装后的执行路径存储在可执行文件中pip.exe

使用十六进制编辑器或写字板编辑此文件(您必须将其保存为纯文本然后保留二进制数据),使用引号和空格将Python路径更改为如下所示:

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

到没有空格和引号的转义路径,并以空格填充(末尾的点应为空格):

#!C:\Progra~2\Python33\python.exe.............

对于“ C:\ Program Files”,此路径可能是“ C:\ Progra〜1”(在DOS / Windows 3.x表示法中,缩短的路径名使用波浪号和数字)。Windows提供了此备用符号,以便与DOS / Windows 3.x应用程序向后兼容。

请注意,由于这是一个二进制文件,因此不应更改可能会破坏可执行文件的文件大小,因此可能会导致填充。

使用管理员权限进行保存,请确保将其实际保存在目标位置,然后重试。

您可能还需要将PATH变量设置为使用~指向路径的符号pip

On Windows at least, pip stores the execution path in the executable pip.exe when it is installed.

Edit this file using a hex editor or WordPad (you have to save it as plain text then to retain binary data), change the path to Python with quotes and spaces like this:

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

to an escaped path without spaces and quotes and pad with spaces (dots at the end should be spaces):

#!C:\Progra~2\Python33\python.exe.............

For “C:\Program Files”, this path would probably be “C:\Progra~1” (shortened path names in DOS / Windows 3.x notation use tilde and numbers). Windows provides this alternative notation for backwards compatibility with DOS / Windows 3.x apps.

Note that as this is a binary file, you should not change the file size which may break the executable, hence the padding.

Save with administrator privileges, make sure it is actually saved at the target location and try again.

You might also need to set the PATH variable to use the ~ notation for the path to pip.


回答 2

与我在https://pip.pypa.io/en/latest/installing.html#install-pip中阅读的要更新pip的问题相同:

python -m pip install -U pip

所以我做了(例如)

python -m pip install virtualenv

而且有效!因此,您可以通过“ virtualenv”另一个所需的软件包来执行相同的操作。

having the same trouble I read in https://pip.pypa.io/en/latest/installing.html#install-pip that to update pip it’s:

python -m pip install -U pip

So I made (for example)

python -m pip install virtualenv

And it worked! So you can do the same being ‘virtualenv’ another package you want.


回答 3

python -m pip

确实可以解决问题Fatal error in launcher: Unable to create process using '"'。在Windows 10上工作

python -m pip

really works for the problem Fatal error in launcher: Unable to create process using '"'.Worked on Windows 10


回答 4

我有一个类似的问题,升级点对我来说已经解决了。

python -m pip install --upgrade pip 

这是在Windows上,pip.exe中的python路径不正确。有关路径的更多信息,请参见Archimedix答案

I had a similar issue and upgrading pip fixed it for me.

python -m pip install --upgrade pip 

This was on Windows and the path to python inside pip.exe was incorrect. See Archimedix answer for more information about the path.


回答 5

这是我解决的方法:

  1. pip.exe在7zip中打开并解压缩__main__.py到Python \ Scripts文件夹。

    就我而言 C:\Program Files (x86)\Python27\Scripts

  2. 重命名__main__.pypip.py

  3. 运行! python pip.py install something

编辑:

如果您希望能够pip install something从任何地方进行操作,也可以执行以下操作:

  1. 将pip.py重命名为pip2.py(以避免导入pip错误)

  2. 使C:\Program Files (x86)\Python27\pip.bat具有以下内容:

python“ C:\ Program Files(x86)\ Python27 \ Scripts \ pip2.py”%1%2%3%4%5%6%7%8%9

  1. 添加C:\Program Files (x86)\Python27到您的PATH(如果尚未添加)

  2. 运行! pip install something

Here’s how I solved it:

  1. open pip.exe in 7zip and extract __main__.py to Python\Scripts folder.

    In my case it was C:\Program Files (x86)\Python27\Scripts

  2. Rename __main__.py to pip.py

  3. Run it! python pip.py install something

EDIT:

If you want to be able to do pip install something from anywhere, do this too:

  1. rename pip.py to pip2.py (to avoid import pip errors)

  2. make C:\Program Files (x86)\Python27\pip.bat with the following contents:

python “C:\Program Files (x86)\Python27\Scripts\pip2.py” %1 %2 %3 %4 %5 %6 %7 %8 %9

  1. add C:\Program Files (x86)\Python27 to your PATH (if is not already)

  2. Run it! pip install something


回答 6

当路径中有空格时,这是一个已知的错误virtualenv。已进行更正,并将在下一版本中可用。

This is a known Bug when there is a space in the virtualenv path. Correction has been made, and will be available in the next version.


回答 7

我有同样的问题,并使用以下方法进行了点升级,现在效果很好。 python -m pip install --upgrade pip

i had same issue and did a pip upgrade using following and now it works fine. python -m pip install --upgrade pip


回答 8

我写了一个脚本来修补那些exe。但是最好的方法是修复distutil本身。

"""Fix "Fatal error in launcher: Unable to create process using ..." error. Put me besides those EXE made by pip. (They are made by distutils, and used by pip)"""
import re
import sys
import os
from glob import glob


script_path = os.path.dirname(os.path.realpath(__file__))
real_int_path = sys.executable
_t = script_path.rpartition(os.sep)[0] + os.sep + 'python.exe'
if script_path.lower().endswith('scripts') and os.path.isfile(_t):
    real_int_path = _t

print('real interpreter path: ' + real_int_path)
print()

for i in glob('*.exe'):
    with open(i, 'rb+') as f:
        img = f.read()
        match = re.search(rb'#![a-zA-Z]:\\.+\.exe', img)
        if not match:
            print("can't fix file: " + i)
            continue
        int_path = match.group()[2:].decode()
        int_path_start = match.start() + 2
        int_path_end = match.end()

        if int_path.lower() == real_int_path.lower():
            continue
        print('fix interpreter path: %s in %s' % (int_path, i))
        f.seek(int_path_start)
        f.write(real_int_path.encode())
        f.write(img[int_path_end:])

I wrote a script to patch those exe. But the best way is to fix distutil itself.

"""Fix "Fatal error in launcher: Unable to create process using ..." error. Put me besides those EXE made by pip. (They are made by distutils, and used by pip)"""
import re
import sys
import os
from glob import glob


script_path = os.path.dirname(os.path.realpath(__file__))
real_int_path = sys.executable
_t = script_path.rpartition(os.sep)[0] + os.sep + 'python.exe'
if script_path.lower().endswith('scripts') and os.path.isfile(_t):
    real_int_path = _t

print('real interpreter path: ' + real_int_path)
print()

for i in glob('*.exe'):
    with open(i, 'rb+') as f:
        img = f.read()
        match = re.search(rb'#![a-zA-Z]:\\.+\.exe', img)
        if not match:
            print("can't fix file: " + i)
            continue
        int_path = match.group()[2:].decode()
        int_path_start = match.start() + 2
        int_path_end = match.end()

        if int_path.lower() == real_int_path.lower():
            continue
        print('fix interpreter path: %s in %s' % (int_path, i))
        f.seek(int_path_start)
        f.write(real_int_path.encode())
        f.write(img[int_path_end:])

回答 9

我在Windows 10上遇到了相同的问题,尝试了所有先前的解决方案后问题仍然存在,所以我决定卸载python 2.7并安装2.7.13版,它可以完美运行。

I had the same issue on windows 10, after trying all the previous solution the problem persists so I decided to uninstall my python 2.7 and install the version 2.7.13 and it works perfectly.


回答 10

如果在Windows上使用区分大小写的文件系统,则可能会发生这种情况。您可以判断是否存在目录中的lib目录和目录:Libvenv

> dir

Directory: C:\git\case\sensitive\filesystem\here\venv

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        4/07/2018   4:10 PM                Include
d-----       22/01/2019   7:52 AM                Lib
d-----       22/01/2019   7:52 AM                lib
d-----       22/01/2019   7:52 AM                Scripts
d-----       22/01/2019   7:52 AM                tcl

要解决此问题(直到virtualenv.py得到解决:https : //github.com/pypa/virtualenv/issues/935),请合并两个lib目录并使venv大小写不敏感:

cd venv
move Lib rmthis
move .\rmthis\site-packages\ lib
rmdir rmthis
fsutil.exe file setCaseSensitiveInfo . disable

This can happen if you are using a case-sensitive file system on Windows. You can tell if this is the case if there is both a lib directory and a Lib directory in your venv directory :

> dir

Directory: C:\git\case\sensitive\filesystem\here\venv

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        4/07/2018   4:10 PM                Include
d-----       22/01/2019   7:52 AM                Lib
d-----       22/01/2019   7:52 AM                lib
d-----       22/01/2019   7:52 AM                Scripts
d-----       22/01/2019   7:52 AM                tcl

To workaround this (until virtualenv.py gets fixed: https://github.com/pypa/virtualenv/issues/935) merge the two lib directories and make venv case-insensitive:

cd venv
move Lib rmthis
move .\rmthis\site-packages\ lib
rmdir rmthis
fsutil.exe file setCaseSensitiveInfo . disable

回答 11

请添加此地址:

C:\ Program文件(x86)\ Python33

在Windows PATH变量中

尽管首先确保这是Python exe文件所在的文件夹,然后才将此路径添加到PATH变量。

要在PATH变量中附加地址,请转到

控制面板->系统->高级系统设置->环境变量->系统变量->路径->编辑->

然后附加上述路径并点击保存

Please add this address :

C:\Program Files (x86)\Python33

in Windows PATH Variable

Though first make sure this is the folder where Python exe file resides, then only add this path to the PATH variable.

To append addresses in PATH variable, Please go to

Control Panel -> Systems -> Advanced System Settings -> Environment Variables -> System Variables -> Path -> Edit ->

Then append the above mentioned path & click Save


回答 12

改名的可执行python.exe到如python27.exe。关于Archimedix的答案,我使用十六进制编辑器打开了pip.exe ,滚动到文件末尾,python.exe并将路径更改为python27.exe。在进行编辑时,请不要忽略其他信息。

I renamed the executable of python.exe to e.g. python27.exe. In respect to the answer of Archimedix I opened my pip.exe with a Hex-Editor, scrolled to the end of the file and changed the python.exe in the path to python27.exe. While editing make shure you don’t override other informations.


回答 13

我添加了anwer,因为在本地配置ODDO9源代码时遇到了相同的错误,并且在运行exe时需要exe才能运行,我也遇到了相同的错误。

从昨天开始,我就配置了oddo 9.0(部分:-“在requirements.txt文件中列出的Python依赖项。”),并且需要以如下方式运行PIP exe:

C:\ YourOdooPath> C:\ Python27 \ Scripts \ pip.exe安装-r requirements.txt

我的奇怪路径是:-D:\ Program Files(x86)\ Odoo 9.0-20151014我的pip位置是:-D:\ Program Files(x86)\ Python27 \ Scripts \ pip.exe

因此,我打开命令提示符并转到上面的奇怪路径,并尝试使用这些组合运行pip exe,但始终没有给出以上错误。

  1. D:\ Program Files(x86)\ Python27 \ Scripts \ pip.exe安装-r requirements.txt
  2. “ D:\ Program Files(x86)\ Python27 \ Scripts \ pip.exe安装-r requirements.txt” Python27 \ Scripts \ pip.exe安装-r requirements.txt

  3. “ Python27 / Scripts / pip.exe安装-r requirements.txt”

我通过@ user4154243回答解决了我的问题,谢谢。

步骤1:添加变量(如果您的路径不在变量的路径中)。

步骤2:进入命令提示符,打开安装路径。

步骤3:运行此命令python -m pip install XXX将运行并安装东西。

I added my anwer because I have getting the same error while configure ODDO9 source code in local and its need the exe to run while run exe, I got the same error.

From yesterday I was configure oddo 9.0 (section :- “Python dependencies listed in the requirements.txt file.”) and its need to run PIP exe as

C:\YourOdooPath> C:\Python27\Scripts\pip.exe install -r requirements.txt

My oddo path is :- D:\Program Files (x86)\Odoo 9.0-20151014 My pip location is :- D:\Program Files (x86)\Python27\Scripts\pip.exe

So I open command prompt and go to above oddo path and try to run pip exe with these combination, but not given always above error.

  1. D:\Program Files (x86)\Python27\Scripts\pip.exe install -r requirements.txt
  2. “D:\Program Files (x86)\Python27\Scripts\pip.exe install -r requirements.txt” Python27\Scripts\pip.exe install -r requirements.txt

  3. “Python27/Scripts/pip.exe install -r requirements.txt”

I resolved my issue by the @user4154243 answer, thanks for that.

Step 1: Add variable(if your path is not comes in variable’s path).

Step 2: Go to command prompt, open oddo path where you installed.

Step 3: run this command python -m pip install XXX will run and installed the things.


回答 14

如果您同时安装我在Window中解决了我的问题 python2和python3,

您需要输入某人\脚本将所有file.exe更改为file27.exe,然后解决

我的D:\ Python27 \ Scripts将django-admin.exe编辑为django-admin27.exe从而完成了

i solve my problem in Window if u install both python2 and python3

u need enter someone \Scripts change all file.exe to file27.exe,then it solve

my D:\Python27\Scripts edit django-admin.exe to django-admin27.exe so it done


回答 15

我的确切问题是(在启动器中出现致命错误:无法使用’“’创建进程)在Windows 10上。所以我导航至” C:\ Python33 \ Lib \ site-packages“并删除了django文件夹和pip文件夹,然后重新安装了django使用点,我的问题就解决了。

My exact problem was (Fatal error in launcher: Unable to create process using ‘”‘) on windows 10. So I navigated to the “C:\Python33\Lib\site-packages” and deleted django folder and pip folders then reinstalled django using pip and my problem was solved.


回答 16

我选择不为所有用户安装Windows(64位)Python,而是为我安装。

重新安装Python-x64并检查“针对所有用户”的高级选项为我解决了pip问题。

I have chosen to install Python for Windows (64bit) not for all users, but just for me.

Reinstalling Python-x64 and checking the advanced option “for all users” solved the pip problem for me.


回答 17

这是我固定的方法。

  1. 下载https://bootstrap.pypa.io/get-pip.py
  2. 活跃你的活力
  3. 导航至get-pip.py文件,然后键入“ python get-pip.py”(不带引号)。

它将在环境中重新安装您的pip并自动卸载以前的版本。

现在繁荣!安装任何您喜欢的东西

Here is how i fixed it.

  1. Download https://bootstrap.pypa.io/get-pip.py
  2. Active your vitualenv
  3. Navigate to the get-pip.py file and type “python get-pip.py” without quote.

it will reinstall your pip within the environment and uninstall the previous version automatically.

now boom!! install whatever you like


回答 18

尝试使用以下链接重新安装,

下载https://bootstrap.pypa.io/get-pip.py

下载后,将“ get-pip.py”复制到python安装的主目录中,然后打开cmd并导航到python目录并键入“ python get-pip.py”(不带引号)

注意:还要确保在环境变量中设置了python目录。

希望这会有所帮助。

Try reinstall by using the below link,

Download https://bootstrap.pypa.io/get-pip.py

After download, copy the “get-pip.py” to python installed main dirctory, then open cmd and navigate to python directory and type “python get-pip.py” (without quotes)

Note: Also make sure the python directory is set in the environmental variable.

Hope this might help.


回答 19

对我来说,当我将环境路径更改为指向v2.7时出现了这个问题,该路径最初指向v3.6。之后,要运行pipvirtualenv命令,我必须python -m pip install XXX按照以下答案中的说明进行操作。

因此,为了摆脱这种情况,我再次运行v2.7安装程序,选择了change选项,并确保启用了“ 添加到路径”选项,然后运行安装程序。之后,一切都会正常进行。

For me this problem appeared when I changed the environment path to point to v2.7 which was initially pointing to v3.6. After that, to run pip or virtualenv commands, I had to python -m pip install XXX as mentioned in the answers below.

So, in order to get rid of this, I ran the v2.7 installer again, chose change option and made sure that, add to path option was enabled, and let the installer run. After that everything works as it should.


回答 20

我遇到了这个问题,并且此页面上的其他修复没有完全解决问题。

解决问题的方法是进入我的系统环境变量并查看PATH-我已经卸载了Python 3,但是Python 3文件夹的旧路径仍然存在。我在PC上仅运行Python 2,并使用Python 2安装pip。

除了升级到最新版本以外,还从PATH中删除对不存在的Python 3文件夹的引用pip

I had this issue and the other fixes on this page didn’t fully solve the problem.

What did solve the problem was going in to my system environment variables and looking at the PATH – I had uninstalled Python 3 but the old path to the Python 3 folder was still there. I’m running only Python 2 on my PC and used Python 2 to install pip.

Deleting the references to the nonexistent Python 3 folders from PATH in addition to upgrading to the latest version of pip fixed the issue.


回答 21

我有一个更简单的解决方案。使用@apple方式,但将main .py 重命名为pip.py,然后将其放在python版本的scripts文件夹中,并将scripts文件夹添加到您的路径中以全局访问它。如果您不想将其添加到路径,则必须将其cd到脚本,然后运行pip命令。

I had a simpler solution. Using @apple way but rename main.py to pip.py then put it in your python version scripts folder and add scripts folder to your path access it globally. if you don’t want to add it to path you have to cd to scripts and then run pip command.


回答 22

Windows上我通过以下方式解决了此问题:

1)卸载Python

2)导航到C:\Users\MyName\AppData\Local\Programs(您应该打开隐藏文件的可见性,显示隐藏文件的说明

3)删除“ Python”文件夹

4)安装Python

On Windows I had solved this problem in the following way :

1) uninstalled Python

2) navigated to C:\Users\MyName\AppData\Local\Programs(your should turn on hidden files visibility Show hidden files instruction)

3) deleted ‘Python’ folder

4) installed Python


回答 23

通过卸载python3.7和安装python3.8重新安装python时,我遇到类似的问题。但是我通过删除先前版本的python目录解决了。对我来说它就在这里

C:\ Users \您的用户名\ AppData \ Local \ Programs \ Python

我删除了名为Python37的文件夹(对于以前的版本),并保留了Python38(对于更新的版本)。之所以有用,是因为python本身似乎很难为您的python脚本找到正确的目录。

I have similar problem when I reinstall my python, by uninstalling python3.7 and installing python3.8. But I solved it by removing the previous version of python directory. For me it was located here,

C:\Users\your-username\AppData\Local\Programs\Python

I deleted the folder named Python37 (for previous version) and keep Python38 (for updated version). This worked because python itself seems having a trouble on finding the right directory for your python scripts.


回答 24

我试图安装一些站点软件包,例如numpy,xgboost等,但是每次都会显示此错误:

Fatal error in launcher: Unable to create process using

我尝试了多种方法来解决此问题,并找到了一个成功地帮助了我的方法:

python -m pip freeze

希望它也能帮助别人。

PS我在这里找到了这个解决方案:https : //stackoverflow.com/a/39733705/10310794

I was trying to install some site-packages like numpy, xgboost and so on, but this error showed up every time:

Fatal error in launcher: Unable to create process using

I’ve tried many ways to solve this problem and found this one, that successfully helped me:

python -m pip freeze

Hope it’ll help someone too.

P.S. I found this solution here: https://stackoverflow.com/a/39733705/10310794


回答 25

您可以从PC删除先前的python文件夹以及环境变量路径,然后重新安装python。它将解决

You can remove previous python folder and also environment variable path from you pc then Reinstall python .it will be solve


回答 26

而不是直接调用ipython,而是使用诸如

$ python“ ipython.exe的完整路径”

Instead of calling ipython directly, it is loaded using Python such as

$ python “full path to ipython.exe”


声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。