2017-08-15 232 views
0

隨着PyCharm我嘗試添加一個項目解釋爲我的碼頭工人集裝箱PIP安裝軟件包失敗

enter image description here

但後來我得到這個令人費解的錯誤。

Invalid requirement: 'redis\>=2.10.5' 
Traceback (most recent call last): 
    File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 82, in __init__ 
    req = Requirement(req) 
    File "/usr/local/lib/python2.7/site-packages/pip/_vendor/packaging/requirements.py", line 96, in __init__ 
    requirement_string[e.loc:e.loc + 8])) 
InvalidRequirement: Invalid requirement, parse error at "'\\>=2.10.' 

enter image description here

我能做些什麼呢?

+1

您是否嘗試過更新pip和setuptools? 'pip install -U pip setuptools' –

+0

@NelsonYeung在Docker容器或我的主機操作系統中?我不明白。 –

+0

是的,我嘗試更新泊塢內的容器。它不起作用。 –

回答

0

pip官方文檔:

https://pip.pypa.io/en/stable/reference/pip_install/#examples

$ pip install SomePackage   # latest version 
$ pip install SomePackage==1.0.4  # specific version 
$ pip install 'SomePackage>=1.0.4'  # minimum version 

看來你必須使用撇號最低版本。

+0

但我使用'requirements.txt',我看到撇號在崩潰和錯誤時使用。 –

+0

在錯誤信息中,似乎執行的命令缺少撇號。 –

+0

要求包含反斜槓,以便在控制檯輸出中看到。也許這是問題... –

0

反斜槓redis\>=2.10.5是問題的罪魁禍首。將redis\>=2.10.5替換爲'redis>=2.10.5'