使用 pip install 固定 git 修订版的版本号 --target



我在单独的存储库中有两个Python项目,例如:commondepends_on_common

由于我们部署环境的限制(我没有 ssh 访问权限(,我希望使用

pip install --no-deps --target common /path/to/common

作为 CI/CD 构建阶段的一部分,在depends_on_common中供应商common。我想做的是指定通用的显式版本或 git 修订版,而不是有效地总是基于快照构建。

文档中没有提到此功能:

-t, --target <dir>
Install packages into <dir>. By default this will not replace existing files/folders in <dir>. Use --upgrade to replace existing packages in <dir> with new versions.

但我希望有一些聪明的方法来实现这一点。

也许pip install文档的这一部分可以让你朝着正确的方向前进。

你可能想要这样的东西:

pip install --no-deps --target ./common git+file:///path/to/common@da39a3ee5e6b4b0d3255bfef95601890afd80709#egg=common

最新更新