python - 如何从 requirements.txt 文件中选择特定版本
问题描述
我有 requirements.txt 文件,我在其中给出了带有版本的自定义包名称,如下所示,
custom-package >= 1.0.1
现在在我的仓库中,我有如下版本
custom-package-1.0.1.tar.gz
custom-package-1.0.4.tar.gz
custom-package-5.0.0.tar.gz
现在如果我运行 pip install requirements.txt ,那么它会选择 5.0.0。这是可以理解的。但我怎么能确定,它应该只选择以 1 而不是 5 开头的版本。
解决方案
如果您想要任何以 1 开头的版本,只需指定版本不应超过 2.0.0:
custom-package >= 1.0.1, < 2.0.0
或者如果你想要一个确切的版本:
custom-package == 1.0.1
推荐阅读
- pandas - 分类变量回归
- python - 他们有什么方法可以将 vocareum(aws 学生门户)与 Python 连接起来吗?
- r - 即使在 R 中使用 tapply 为 NA 时,如何获取元素/列
- c++ - 通用 boost::beast HTTP(s) 客户端
- reactjs - ReactJs-在渲染不同的组件(`Header`)时无法更新组件(`TheLayout`)。在 `Header` 中定位错误的 setState() 调用
- azure - 将 Office 365 作为 Azure 云上的 SaaS 访问列入白名单
- facebook - 发现了一些冲突的依赖关系。修改了以下依赖版本:
- c# - 当我第二次实例化预制件时,为什么会出现错误?
- .net-core - 如何清除以前的 Signal R Web Socket 连接?
- azure - 如何在 azure 中首先运行任务后运行 ansible 角色