搜索网络,这似乎是由Python安装路径中的空格引起的问题。
我如何让pip工作,而不必重新安装在一个没有空格的路径中的所有东西?
搜索网络,这似乎是由Python安装路径中的空格引起的问题。
我如何让pip工作,而不必重新安装在一个没有空格的路径中的所有东西?
当前回答
我在windows 10上也有同样的问题,在尝试了之前所有的解决方案后,问题仍然存在,所以我决定卸载我的python 2.7并安装2.7.13版本,它工作得很好。
其他回答
当virtualenv路径中有空格时,这是一个已知的错误。更正已做,并将提供在下一个版本。
以下是我的解决方法:
在7zip文件中打开pip.exe,并将__main__.py解压到Python\Scripts文件夹中。 对我来说,是C:\Program Files (x86)\Python27\Scripts 将__main__.py重命名为pip.py 运行它!Python pip.py安装东西
编辑:
如果你想在任何地方安装一些东西,也可以这样做:
重命名PIP .py为pip2.py(以避免导入PIP错误) 制作C:\Program Files (x86)\Python27\pip.bat,内容如下:
C:\Program Files (x86)\Python27\Scripts\pip2.py" %1 %2 %3 %4 . python %5 %6 %7 %8 %9
将C:\Program Files (x86)\Python27添加到您的PATH(如果还没有) 运行它!PIP安装
我写了一个脚本补丁那些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:])
我添加了我的答案,因为我在本地配置ODDO9源代码时得到了相同的错误,它需要exe运行而运行exe,我得到了相同的错误。
从昨天开始,我配置了oddo 9.0(章节:“在requirements.txt文件中列出的Python依赖项。”),它需要运行PIP exe作为
C:\Python27\Scripts\pip.exe install -r requirements.txt
我的oddo路径是:D:\Program Files (x86)\Odoo 9.0-20151014 我的pip位置是:- D:\Program Files (x86)\Python27\Scripts\pip.exe
所以我打开命令提示符,转到上面的oddo路径,并尝试使用这些组合运行pip exe,但并不总是给出以上错误。
D:\Program Files (x86)\Python27\Scripts\pip.exe安装-r requirements.txt "D:\Program Files (x86)\Python27\Scripts\pip.exe install -r requirements.txt" Python27\Scripts\pip.exe安装-r requirements.txt "Python27/Scripts/pip.exe install -r requirements.txt"
我通过@user4154243的答案解决了我的问题,谢谢。
第一步:添加变量(如果你的路径不在变量的路径中)。
第二步:进入命令提示符,打开oddo安装路径。
第三步:运行此命令python -m pip install XXX将运行并安装的东西。
我也有同样的问题,并使用以下进行了PIP升级,现在它工作正常。 Python -m PIP install——升级PIP