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

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


当前回答

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

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

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

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

希望这能有所帮助。

其他回答

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

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

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

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

希望这能有所帮助。

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

在Windows上,我用以下方法解决了这个问题:

1)卸载Python

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

3)删除“Python”文件夹

4)安装Python

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

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

我在https://pip.pypa.io/en/latest/installing.html#install-pip上看到了同样的问题,更新pip是:

python -m pip install -U pip

所以我做了(比如)

Python -m PIP安装virtualenv

它成功了!所以你可以做同样的'virtualenv'另一个你想要的包。