首页 > 解决方案 > Pipenv:即使使用 pipenv lock --clear 也无法解决依赖关系

问题描述

我正在使用 pipenv 版本“2018.7.1”和 pip 18.0。

我有一个Pipfile并运行pipenv install.

它失败了: Could not find a version that matches prompt-toolkit<2.0.0,<2.1.0,==2.0.7,>=1.0.0,>=1.0.4,>=2.0.0 Tried: 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 0.9, 0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.25, 0.26, 0.28, 0.30, 0.31, 0.32, 0.32, 0.32, 0.33, 0.33, 0.33, 0.34, 0.34, 0.34, 0.35, 0.35, 0.35, 0.36, 0.36, 0.36, 0.37, 0.37, 0.37, 0.38, 0.38, 0.38, 0.39, 0.39, 0.39, 0.40, 0.40, 0.40, 0.41, 0.41, 0.41, 0.42, 0.42, 0.42, 0.43, 0.43, 0.43, 0.44, 0.44, 0.44, 0.45, 0.45, 0.45, 0.46, 0.46, 0.46, 0.47, 0.47, 0.47, 0.48, 0.48, 0.48, 0.49, 0.49, 0.49, 0.50, 0.50, 0.50, 0.51, 0.51, 0.51, 0.52, 0.52, 0.52, 0.53, 0.53, 0.53, 0.54, 0.54, 0.54, 0.55, 0.55, 0.55, 0.56, 0.56, 0.56, 0.57, 0.57, 0.57, 0.58, 0.58, 0.58, 0.59, 0.59, 0.59, 0.60, 0.60, 0.60, 1.0.0, 1.0.0, 1.0.0, 1.0.1, 1.0.1, 1.0.1, 1.0.2, 1.0.2, 1.0.2, 1.0.3, 1.0.3, 1.0.3, 1.0.4, 1.0.4, 1.0.4, 1.0.5, 1.0.5, 1.0.5, 1.0.6, 1.0.6, 1.0.6, 1.0.7, 1.0.7, 1.0.7, 1.0.8, 1.0.8, 1.0.8, 1.0.9, 1.0.9, 1.0.9, 1.0.10, 1.0.10, 1.0.10, 1.0.13, 1.0.13, 1.0.13, 1.0.14, 1.0.14, 1.0.14, 1.0.15, 1.0.15, 1.0.15, 2.0.1, 2.0.1, 2.0.1, 2.0.2, 2.0.2, 2.0.2, 2.0.3, 2.0.3, 2.0.3, 2.0.4, 2.0.4, 2.0.4, 2.0.5, 2.0.5, 2.0.5, 2.0.6, 2.0.6, 2.0.6, 2.0.7, 2.0.7, 2.0.7 There are incompatible versions in the resolved dependencies.

我检查了 https://pipenv.readthedocs.io/en/latest/diagnose/他们建议尝试

pipenv lock --clear

和/或清除整个缓存目录。我都尝试了,但得到与上面相同的错误。我检查结果

pipenv graph

并看到所有对prompt-toolkit(失败的依赖项)的引用看起来像:

- prompt-toolkit [required: >=1.0.4,<2.0.0, installed: 1.0.15].

所以现在我非常困惑,因为看起来根本不应该存在依赖冲突。任何想法为什么会发生这种情况以及如何解决?

标签: pythonpipenv

解决方案


如果您忽略了任何提到的依赖关系,Peilonrayz 的回答会很棒。正如您所提到的,有时pipenv不会显示影响可解析性的子依赖项。

尝试使用pipenv lock -clear -verbose,您还将获得有关子依赖项的信息。您可以在它们中搜索'==2.0.7'(这看起来是您的“缺失”依赖项。一旦找到要求的子依赖项,'==2.0.7'您就可以解决问题。


推荐阅读