尝试pip
安装repo的特定分支。谷歌告诉我
点击安装git + https://github.com/user/repo.git@branch
分支的名字是issue/34/oscar-0.6
所以我做了pip install https://github.com/tangentlabs/django-oscar-paypal.git@/issue/34/oscar-0.6
,但它返回404。
我该如何安装这个分支?
前缀url前缀git+
(请参阅VCS Support):
pip install git+https://github.com/tangentlabs/django-oscar-paypal.git@issue/34/oscar-0.6
并指定没有前导/
的分支名称。
使用带git +的pip来克隆存储库可能非常慢(例如,使用https://github.com/django/django@stable/1.6.x进行测试,需要几分钟)。我发现的最快的东西是GitHub和BitBucket,它是:
pip install https://github.com/user/repository/archive/branch.zip
成为django大师:
pip install https://github.com/django/django/archive/master.zip
对于django stable / 1.7.x:
pip install https://github.com/django/django/archive/stable/1.7.x.zip
使用BitBucket,它具有相同的可预测模式:
pip install https://bitbucket.org/izi/django-admin-tools/get/default.zip
这里,主分支通常被命名为default。这将使您的requirements.txt安装更快。
其他一些答案提到了将要安装的软件包放入requirements.txt
时所需的变化。请注意,使用此归档语法,不需要领先的-e
和尾随#egg=blah-blah
,您只需粘贴URL,因此您的requirements.txt如下所示:
https://github.com/user/repository/archive/branch.zip
只是添加一个额外的,如果你想在你的pip文件中安装它,可以像这样添加:
-e git+https://github.com/tangentlabs/django-oscar-paypal.git@issue/34/oscar-0.6#egg=django-oscar-paypal
它虽然会被保存为鸡蛋。
使用ssh凭据从私有存储库安装的说明。
用法:
$ pip install git+ssh://[email protected]/myuser/foo.git@my_version
用于开发:
$ git clone [email protected]/myuser/foo.git@my_version
$ pip install --editable ./
您使用了egg文件安装过程。此程序支持在git
,git+http
,git+https
,git+ssh
,git+git
和git+file
上安装。其中一些是提到的。
你可以使用分支,标签或哈希来安装。
@Steve_K注意到使用“git +”安装速度很慢,建议通过zip文件安装:
pip install https://github.com/user/repository/archive/branch.zip
或者,我建议您可以使用.whl
文件进行安装(如果存在)。
pip install https://github.com/user/repository/archive/branch.whl
这是一种非常新的格式,比egg文件更新。它需要wheel和setuptools> = 0.8包。你可以在here找到更多。