配置,以便pip安装可以从github工作 [英] Configuring so that pip install can work from github

查看:610
本文介绍了配置,以便pip安装可以从github工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们希望使用pip和github将私人包安装到我们的生产服务器上。这个问题涉及为了安装成功需要在github仓库中需要什么。



假设以下命令行(认证正确并尝试安装) :

  pip install git + ssh://git@github.com/BlahCo/search/tree/prod_release_branch/ProductName 

需要驻留在ProductName中的什么?是否通过sdist选项运行setup.py后,通常在tar文件中的内容,还是实际的tar.gz文件或其他内容?

我在这里问,因为我已经尝试了几种变化,无法使它工作。任何帮助表示赞赏。

解决方案

您需要整个python包, setup.py

一个名为 foo 的包将是:

  foo#可安装的软件包
├──foo
│├──__init__.py
│└──bar .py
└──setup.py

并从github安装:

  $ pip install git + https://github.com/myuser/foo.git@v123 

$ pip install git + https://github.com/myuser/foo.git@newbranch

更多info at https://pip.pypa.io/en/stable / reference / pip_install /#vcs-support

We'd like to use pip with github to install private packages to our production servers. This question concerns what needs to be in the github repo in order for the install to be successful.

Assuming the following command line (which authenticates just fine and tries to install):

pip install git+ssh://git@github.com/BlahCo/search/tree/prod_release_branch/ProductName

What needs to reside in the ProductName? Is it the contents of what would normally be in the tar file after running setup.py with the sdist option, or is the actual tar.gz file, or something else?

I'm asking here because I've tried several variations and can't make it work. Any help appreciated.

解决方案

You need the whole python package, with a setup.py file in it.

A package named foo would be:

foo # the installable package
├── foo
│   ├── __init__.py
│   └── bar.py
└── setup.py

And install from github like:

$ pip install git+https://github.com/myuser/foo.git@v123
or
$ pip install git+https://github.com/myuser/foo.git@newbranch

More info at https://pip.pypa.io/en/stable/reference/pip_install/#vcs-support

这篇关于配置,以便pip安装可以从github工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆