试图pip安装一个回购的特定分支。谷歌告诉我

pip install https://github.com/user/repo.git@branch

分支的名称是issue/34/oscar-0.6,所以我安装了https://github.com/tangentlabs/django-oscar-paypal.git@/issue/34/oscar-0.6,但它返回404。

如何安装这个分支?


当前回答

对于windows和pycharm设置:

如果你正在使用pycharm和如果你想使用pip3安装git+https://github.com/…

首先,你应该从https://git-scm.com/downloads下载git 然后重新启动pycharm 你可以使用pycharm终端来安装你想要的

其他回答

使用pip和git+来克隆存储库可能会非常慢(例如,使用https://github.com/django/django@stable/1.6.x进行测试,将花费几分钟)。我发现的最快的东西,它与GitHub和BitBucket一起工作,是:

pip install https://github.com/user/repository/archive/branch.zip

这变成了Django master:

pip install https://github.com/django/django/archive/master.zip

for 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

不过它会被保存成鸡蛋。

这招很管用:

pip3 install git+https://github.com/deepak1725/fabric8-analytics-worker.git@develop

地点:

发展:分支

fabric8-analytics-worker。git:回购

deepak1725:用户

使用ssh凭证从私人回购安装的说明:

$ pip install git+ssh://git@github.com/myuser/foo.git@my_version

要从子目录安装包,请输入stackoverflow

$ pip install git+ssh://git@github.com/myuser/foo.git@my_version#subdirectory=stackoverflow

https://pip.pypa.io/en/stable/topics/vcs-support/

对于windows和pycharm设置:

如果你正在使用pycharm和如果你想使用pip3安装git+https://github.com/…

首先,你应该从https://git-scm.com/downloads下载git 然后重新启动pycharm 你可以使用pycharm终端来安装你想要的