在Windows 7计算机上,我使用以下命令从本地目录安装软件包:
pip install addons/pnc_tests --upgrade --extra-index-url=http://some_server/simple
会导致以下错误:
C:\Users\alex\PNC\tas\ENV\Scripts\pip-script.py run on 07/16/14 07:50:47
Exception:
Traceback (most recent call last):
File "C:\Users\alex\PNC\tas\ENV\lib\site-packages\pip\basecommand.py", line 122, in main
status = self.run(options, args)
File "C:\Users\alex\PNC\tas\ENV\lib\site-packages\pip\commands\install.py", line 258, in run
InstallRequirement.from_line(name, None))
File "C:\Users\alex\PNC\tas\ENV\lib\site-packages\pip\req.py", line 173, in from_line
return cls(req, comes_from, url=url, prereleases=prereleases)
File "C:\Users\alex\PNC\tas\ENV\lib\site-packages\pip\req.py", line 71, in __init__
req = pkg_resources.Requirement.parse(req)
File "C:\Users\alex\PNC\tas\ENV\lib\site-packages\pip\_vendor\pkg_resources.py", line 2667, in parse
reqs = list(parse_requirements(s))
File "C:\Users\alex\PNC\tas\ENV\lib\site-packages\pip\_vendor\pkg_resources.py", line 2605, in parse_requirements
line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec")
File "C:\Users\alex\PNC\tas\ENV\lib\site-packages\pip\_vendor\pkg_resources.py", line 2573, in scan_list
raise ValueError("Expected "+item_name+" in",line,"at",line[p:])
ValueError: ('Expected version spec in', 'addons/pnc_tests', 'at', '/pnc_tests')
如何解决这个问题?
答案 0 :(得分:17)
我猜你错过了参数-r
;
如果您要安装需求文件,则必须如此;
pip install -r addons/pnc_tests --upgrade --extra-index-url=http://some_server/simple
正如其定义; Pip Documentation
答案 1 :(得分:1)
需要用反斜杠(/
)替换斜杠(\
):
pip install addons\pnc_tests --upgrade --extra-index-url=http://some_server/simple
答案 2 :(得分:0)
在我的系统上,我刚刚指定了错误的目录。仔细检查您的文件夹名称。 X_X