Python pip抱怨依赖版本,但还是安装了它们。为什么?
我有一个如下定义的需求文件:Python pip抱怨依赖版本,但还是安装了它们。为什么?,python,python-3.x,pip,dependencies,boto3,Python,Python 3.x,Pip,Dependencies,Boto3,我有一个如下定义的需求文件: requirements.txt botocore==1.15.11 docutils==0.16 当我点击pip安装-r requirements.txt时,我看到这个错误: botocore 1.15.11 has requirement docutils<0.16,>=0.10, but you'll have docutils 0.16 which is incompatible. 这表明这两个依赖项是按照requirements.txt文
requirements.txt
botocore==1.15.11
docutils==0.16
当我点击pip安装-r requirements.txt时,我看到这个错误:
botocore 1.15.11 has requirement docutils<0.16,>=0.10, but you'll have docutils 0.16 which is incompatible.
这表明这两个依赖项是按照requirements.txt文件中的定义安装的。如果这不是问题,为什么还要抱怨呢?如果是问题,它们是如何安装的 pip当前的依赖项求解器存在一些众所周知的问题(限制和bug)。一个新的(更好的)正在进行中。它已经可以测试了。此答案及其链接中的更多详细信息:
尽管如此,这两个要求是不相容的:
botocore==1.15.11
docutils==0.16
如图所示:
导入和执行的代码可能仍然可以正常工作,但不会出现任何(明显的)问题。例如:可能是BotoCore1.15.11实际上并不完全与Docutils0.16不兼容。要么触发问题的代码路径未命中,要么限制docutilsSo这与pip内的限制有关,而不是与包有关?哦。再次阅读问题,并在我这边进行一些测试,确实。。。这两个要求botocore==1.15.11
和docutils==0.16
似乎确实不兼容:对,我的困惑是pip为什么要安装它们,以及它们是如何工作的。1。好吧,如果我没有弄错的话,pip还是会安装它,因为它当前的依赖项解算器仍然有点弱。如果用户出于某种原因强制安装,那么pip没有理由阻挡安装。2.至于它是如何运作的:你是说程序,导入仍然有效?可能是BotoCore1.15.11实际上并不完全与Docutils0.16不兼容。要么你没有找到会引发问题的代码路径,要么限制只是预防性的。好吧,我想我现在明白了。因此,在pip中有点松懈”然而,当我点击pip安装时,我将其视为输出:“你是指pip list
而不是pip install
?对不起,你是对的。编辑。
botocore 1.15.11
docutils 0.16
jmespath 0.10.0
pip 18.1
python-dateutil 2.8.1
setuptools 40.6.2
six 1.15.0
urllib3 1.25.9
wheel 0.34.2
[bdist_wheel]
universal = 1
[metadata]
requires-dist =
python-dateutil>=2.1,<3.0.0
jmespath>=0.7.1,<1.0.0
docutils>=0.10,<0.16
urllib3>=1.20,<1.25.8; python_version=='3.4'
urllib3>=1.20,<1.26; python_version!='3.4'
$ pip check
botocore 1.15.11 has requirement docutils<0.16,>=0.10, but you have docutils 0.16.