简体   繁体   English

如何在 pip 安装期间覆盖 python package 版本约束

[英]How to override python package version constraint during pip install

We have an organization level constraint file to specify what versions of python packages can be installed.我们有一个组织级别的约束文件来指定可以安装哪些版本的 python 包。 This is configured in pip.conf这个配置在pip.conf

For one of the project, we want to install a different version of a package. For example, pyyaml is pinned at 5.4.1 in constraints file, whereas for the project we would like 6.0对于其中一个项目,我们要安装不同版本的 package。例如,pyyaml 在约束文件中固定在 5.4.1,而对于该项目,我们希望安装 6.0

Tried specifying inline in pip install command,尝试在 pip 安装命令中指定内联,

pip install pyyaml==6.0 

This didn't help as the build failed with conflict error,这没有帮助,因为构建因冲突错误而失败,

ERROR: Cannot install pyyaml==6.0 because these package versions have conflicting dependencies.错误:无法安装 pyyaml==6.0,因为这些 package 版本具有冲突的依赖项。

The conflict is caused by:冲突是由以下原因引起的:
The user requested pyyaml==6.0用户要求pyyaml==6.0
The user requested (constraint) pyyaml==5.4.1用户请求(约束)pyyaml==5.4.1

pip version: 21.3.1
# constrains.txt
   pyyaml==5.4.1
$ pip install pyyaml==6.0 -c constrains.txt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM