问题描述
一般我们在使用pip Install
命令安装Python软件包的时候,会想知道能安装的包版本的是多少,这样方便自己选择可能的兼容版本进行安装,在pip
某个版本之前获取待安装包的所有版本命令比较简单,直接用:
pip install torch==
就会列出所有torch
版本,但最新版的pip
不支持直接用上述命令查找所有torch
的版本,会出现错误:
ERROR: Could not find a version that satisfies the requirement torch==
ERROR: No matching distribution found for torch==
解决方法
新版本的pip
可以用下面的命令进行查找:
pip install torch== --use-deprecated=legacy-resolver
得到结果如下
ERROR: Could not find a version that satisfies the requirement torch== (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2, 0.4.1, 0.4.1.post2, 1.0.0, 1.0.1, 1.0.1.post2, 1.1.0, 1.2.0, 1.3.0, 1.3.1, 1.4.0, 1.5.0, 1.5.1, 1.6.0, 1.7.0, 1.7.1, 1.8.0, 1.8.1)
ERROR: No matching distribution found for torch==
虽然也是ERROR
,但是会列出所有torch
的可安装版本,这样也算是实现了我们的目的。