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

2024-04-25 01:13:05 发布

您现在位置:Python中文网/ 问答频道 /正文

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

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


Tags: installpip版本numpy消息错误
3条回答
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

添加到您的~/.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
1.19.2
1.19.1
等等


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

要查看带有PIP20.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中使用。

相关问题 更多 >