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

我如何让pip工作,而不必重新安装在一个没有空格的路径中的所有东西?


当前回答

对我来说,当我将环境路径从最初指向v3.6的路径改为指向v2.7时,就出现了这个问题。在那之后,要运行pip或virtualenv命令,我必须使用python -m pip install XXX,如下面的答案所述。

因此,为了摆脱这个问题,我再次运行v2.7安装程序,选择更改选项并确保启用了添加到路径选项,并让安装程序运行。在那之后,一切都正常运转。

其他回答

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

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

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

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

希望这能有所帮助。

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

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

我的D:\Python27\脚本编辑django-admin.exe到django-admin27.exe,这样就完成了

对我来说,当我将环境路径从最初指向v3.6的路径改为指向v2.7时,就出现了这个问题。在那之后,要运行pip或virtualenv命令,我必须使用python -m pip install XXX,如下面的答案所述。

因此,为了摆脱这个问题,我再次运行v2.7安装程序,选择更改选项并确保启用了添加到路径选项,并让安装程序运行。在那之后,一切都正常运转。

我试图安装一些站点包,如numpy, xgboost等,但每次都出现这个错误:

Fatal error in launcher: Unable to create process using

我尝试了很多方法来解决这个问题,并找到了这个方法,它成功地帮助了我:

python -m pip freeze

希望它也能帮助到别人。

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

我写了一个脚本补丁那些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:])