如何从 python 中的安装文件中排除特定的依赖包版本
how to exclude particular dependency package version from setup file in python
我有一个小包不能在 torch v1.8.0
上运行,但它在新的 v1.8.1
版本和其他旧版本 v1.7.1
上运行良好,所以想排除 v1.8.0
版本。
我可以设置
install_requires=[
"torch>=1.8.1",
...
但是 torch 包很大,还希望 mypackage
在旧版本的 torch 上工作。
我试过了
install_requires=[
"torch>=1.8.1,!=1.8.0,<=1.7.1",
...
但是在使用 pip install mypackage
安装软件包时出现以下错误:
ERROR: Could not find a version that satisfies the requirement torch!=1.8.0,<=1.7.1,>=1.8.1 (from mypackage) (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!=1.8.0,<=1.7.1,>=1.8.1 (from mypackage)
如何排除v1.8.0
版本?谢谢。
我有一个小包不能在 torch v1.8.0
上运行,但它在新的 v1.8.1
版本和其他旧版本 v1.7.1
上运行良好,所以想排除 v1.8.0
版本。
我可以设置
install_requires=[
"torch>=1.8.1",
...
但是 torch 包很大,还希望 mypackage
在旧版本的 torch 上工作。
我试过了
install_requires=[
"torch>=1.8.1,!=1.8.0,<=1.7.1",
...
但是在使用 pip install mypackage
安装软件包时出现以下错误:
ERROR: Could not find a version that satisfies the requirement torch!=1.8.0,<=1.7.1,>=1.8.1 (from mypackage) (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!=1.8.0,<=1.7.1,>=1.8.1 (from mypackage)
如何排除v1.8.0
版本?谢谢。