gpt4 book ai didi

python - 如何使用 pipfile 在自定义 git 分支的 pipfile 包中指定?

转载 作者:太空狗 更新时间:2023-10-30 01:19:19 30 4
gpt4 key购买 nike

可以在 Pipfile 中指定来自自定义 Git 存储库的包。但是我找不到关于如何指定具体分支或用于安装的提交的综合文档。

是否有关于如何在 pipenv 支持的 Pipfile 中为 python 包使用 Git URL 的完整引用?用于指定自定义分支、版本或提交?

使用等效的 pipenv 命令行参数会非常好。

最佳答案

以下是 pipenv 的 GitHub 存储库上的一些文档:

You can install packages with pipenv from git and other version control systems using URLs formatted according to the following rule:

<vcs_type>+<scheme>://<location>/<user_or_organization>/<repository>@<branch_or_tag>#egg=<package_name>

https://github.com/pypa/pipenv/blob/master/docs/basics.rst#-a-note-about-vcs-dependencies

所以,例如:

[packages]
requests = {git = "https://github.com/requests/requests.git", editable = true, ref = "v2.20.1"}

您可以使用命令行生成 Pipfile。上面的 Pipfile 是通过以下方式生成的:

pipenv install -e git+https://github.com/requests/requests.git@v2.20.1#egg=requests

pip 的文档更详细 here

关于python - 如何使用 pipfile 在自定义 git 分支的 pipfile 包中指定?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47617552/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com