更新python包后出现“InvalidRequirement:无效的要求,解析错误”错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35625488/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"InvalidRequirement: Invalid requirement, parse error" error after updating a python package
提问by ThiefMaster
After updating a package (IPython in my case) using pip install -U ipython
running any Python script that uses entry points fails with this error:
使用pip install -U ipython
运行任何使用入口点的 Python 脚本更新包(在我的情况下为 IPython)后失败并显示以下错误:
Traceback (most recent call last):
File "/home/adrian/dev/indico/env/bin/indico", line 5, in <module>
from pkg_resources import load_entry_point
...
File "/home/adrian/dev/indico/env/lib/python2.7/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 94, in __init__
requirement_string[e.loc:e.loc + 8], requirement_string))
pkg_resources._vendor.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "'< 2.0'"
Nothing else changed, I did not update any other libraries.
没有其他变化,我没有更新任何其他库。
采纳答案by ThiefMaster
This is caused by an issue in setuptools==20.2.1
which is pulled in by IPython (setuptools>..
), so a pip install -U
updated it.
这是setuptools==20.2.1
由 IPython ( setuptools>..
)引入的问题引起的,因此对其进行了pip install -U
更新。
Until a fixed version is released or the broken version is pulled from PyPI there is a simple workaround (but note that it will break again if something updates setuptools):
在发布固定版本或从 PyPI 中提取损坏的版本之前,有一个简单的解决方法(但请注意,如果更新 setuptools 它将再次损坏):
pip install -U pip
pip uninstall setuptools
pip install 'setuptools<20.2'
pip install -U pip
pip uninstall setuptools
pip install 'setuptools<20.2'
The pip
update is needed since older versions of pip
will not work without setuptools
being installed
在pip
因为旧版本的更新,需要pip
将无法正常工作没有setuptools
安装
See these IRC logs and BitBucket issue for details:
有关详细信息,请参阅这些 IRC 日志和 BitBucket 问题:
回答by juanpaolo
Try downgrading your pip to 8.1.1
:
尝试将您的 pip 降级为8.1.1
:
pip install pip==8.1.1
That solved it for me.
那为我解决了。