这是示例场景。
有一个 python 包 not-mine
,我刚刚在其中发现了一个小错误。我在 github 上找到源代码并 fork 存储库。我进行了必要的更改并提交了拉取请求。不幸的是,包作者正在休假,我有一个截止日期。
我需要一种方法来安装我的 fork 存储库,而不是安装在 PyPI 上的作者版本。我尝试了以下但没有成功:
install_requires = [
'not-mine==1.0.0'
],
dependency_links = [
'http://github.com/my-username/not-mine/tarball/master#egg=not-mine-1.0.0'
]
我错过了什么?
我在调查此问题时偶然发现的资源: How can I make setuptools install a package that's not on PyPI?
最佳答案
您应该能够将 pip
指向带有错误修复的 fork 仓库的 URL,因为 pip
can install directly from git repos .
$ pip install git+git://github.com/my-username/not-mine#egg=not-mine
您可以修改 pip install
命令以在“#”之前使用“@”符号指定特定的提交、分支、标记等。
$ pip install git+git://github.com/my-username/not-mine@bugfix_branch#egg=not-mine
关于python - 如何让设置工具安装 github 分支的 PyPI 包?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18264672/