为什么 pip 找不到最新版本的包,即使它存在?

Why does pip not find the newest version of a package even if it exists?

工作人员创建了一个示例 Dockerfile/project/image 让新员工试一试。但是,在尝试 运行 构建图像的脚本时,它抱怨 Python 不满足要求的模块版本。

一个模块是双向的。 requirements.txt 文件要求 0.21.0。我发现该版本存在 here,但是,我收到的错误消息说它找到的最新版本是 0.18.4。

Collecting bidict==0.21.0
  ERROR: Could not find a version that satisfies the requirement bidict==0.21.0 (from versions: 0.1.5, 0.2.1, 0.3.0, 0.3.1, 0.9.0rc0, 0.9.0.post1, 0.10.0, 0.10.0.post1, 0.11.0, 0.12.0.post1, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.14.2, 0.15.0.dev0, 0.15.0.dev1, 0.15.0rc1, 0.15.0, 0.16.0, 0.17.0, 0.17.1, 0.17.2, 0.17.3, 0.17.4, 0.17.5, 0.18.0, 0.18.1, 0.18.2, 0.18.3, 0.18.4)
ERROR: No matching distribution found for bidict==0.21.0

如何确定图像 looking/pointing 位于哪个 Python 模块存储库,以便我可以将其更新为可以看到较新版本模块的其他东西?

仅存在 https://pypi.org/project/bidict/#history 中的版本不足以让 pip 使用它。 Pip 检查 Python 二进制轮的版本兼容性和处理器架构。

bidict 0.18.4 was the last version that did not declare Python version compatibility. Starting from 0.19.0 the project declares "Requires: Python >=3". 0.21.0 声明“要求:Python >=3.6”。

从兼容版本列表中我猜你使用 Python 2.7(你应该在问题中指出)所以你只能使用 0.18.4 及更低版本。对于更高版本,请将 Python 升级到 3.6+(但通常从 2.7 升级非常困难)。