如何使用pip20.3查看可用的pypi包版本



对于numpy,pip install numpy==?不工作。它只是显示一条没有可用软件包版本的错误消息。

这发生在我将pip升级到20.3之后。

添加到您的~/.bashrc

function pipver() { curl -s https://pypi.org/rss/project/$1/releases.xml | sed -n 's/s*<title>([0-9.]*).*/1/p' ;}

然后打开一个新的终端窗口并调用,使用:pipver numpy
替换您正在查找的任何模块的版本信息。

1.19.4
1.19.3
11.19.2
1.11.1
等。。。


它使用curl收集相关的.rss XML,然后通过流编辑器sed进行管道传输,选择与<title>[version.numbers]匹配的行,然后只为您打印出捕获的版本号。

ERROR: Could not find a version that satisfies the requirement numpy==?
ERROR: No matching distribution found for numpy==?

我认为这是你的错误,即使是早期版本的pip和命令";pip-install numpy==";,它曾经返回一个错误和所有版本的列表。我不确定最新版本的pip中的命令,但您可以访问https://pypi.org/project/numpy/#history了解的所有发布

尽管有一种方法可以使用pip show numpy -V了解软件包的安装版本

经过一些研究,我得到了这个python代码,当运行时,它会返回可用的包版本

代码:

import luddite
print(luddite.get_versions_pypi("numpy")) #Change the string here for your package

您需要首先使用以下命令安装此软件包,

pip install luddite

要查看可用的带有pip 20.3的PyPI包版本,请传递--use-deprecated legacy-resolver

此问题记录在https://github.com/pypa/pip/issues/9139.当前的解决方法:

$ pip wheel --no-deps wheel== --use-deprecated legacy-resolver
ERROR: Could not find a version that satisfies the requirement wheel== (from versions: 0.1, 0.2, 0.3, 0.4, 0.4.1, 0.4.2, 0.5, 0.6, 0.7, 0.8, 0.9, 0.9.1, 0.9.2, 0.9.3, 0.9.4, 0.9.5, 0.9.6, 0.9.7, 0.10.0, 0.10.1, 0.10.2, 0.10.3, 0.11.0, 0.12.0, 0.13.0, 0.14.0, 0.15.0, 0.16.0, 0.17.0, 0.18.0, 0.19.0, 0.21.0, 0.22.0, 0.23.0, 0.24.0, 0.25.0, 0.26.0, 0.27.0, 0.28.0, 0.29.0, 0.30.0a0, 0.30.0, 0.31.0, 0.31.1, 0.32.0, 0.32.1, 0.32.2, 0.32.3, 0.33.0, 0.33.1, 0.33.4, 0.33.5, 0.33.6, 0.34.0, 0.34.1, 0.34.2, 0.35.0, 0.35.1, 0.36.0, 0.36.1)
ERROR: No matching distribution found for wheel==
WARNING: You are using pip version 20.3; however, version 20.3.1 is available.

此解决方法将在pip 21中弃用。

这并不能回答您(和我(想要回答的问题,但我只是查看了20.3的文档以及更改日志,发现了zilch。我不会再在这上面浪费时间了,所以我的工作正在恢复。

pip install pip==20.2.4

这并不理想。我可能会受到警告,我应该升级pip,直到他们再次提供该列表或合适的替代方案。

如果你真的需要这个功能,这至少可以让你解决关于包X(在本例中是numpy(的根本问题,直到有人来找你。

最新更新