我们想使用pip和github将私有包安装到我们的生产服务器上.这个问题涉及到github仓库中需要什么才能使安装成功.
假设以下命令行(验证正常并尝试安装):
pip install git+ssh://git@github.com/BlahCo/search/tree/prod_release_branch/ProductName
Run Code Online (Sandbox Code Playgroud)
什么需要驻留在ProductName中?它是使用sdist选项运行setup.py之后通常在tar文件中的内容,还是实际的tar.gz文件或其他内容?
我在这里问,因为我尝试了几种变化而无法使其发挥作用.任何帮助赞赏.
Hug*_*res 275
你需要整个python包,里面有一个setup.py文件.
名为的包foo将是:
foo # the installable package
??? foo
? ??? __init__.py
? ??? bar.py
??? setup.py
Run Code Online (Sandbox Code Playgroud)
并从github安装如下:
$ pip install git+https://github.com/myuser/foo.git@v123
or
$ pip install git+https://github.com/myuser/foo.git@newbranch
Run Code Online (Sandbox Code Playgroud)
更多信息,请访问https://pip.pypa.io/en/stable/reference/pip_install/#vcs-support
小智 106
当我不得不从github repo安装时,我有类似的问题,但不想安装git等.
这样做的简单方法是使用包的zip存档.添加/zipball/master到repo URL:
$ pip install https://github.com/hmarr/django-debug-toolbar-mongo/zipball/master
Downloading/unpacking https://github.com/hmarr/django-debug-toolbar-mongo/zipball/master
Downloading master
Running setup.py egg_info for package from https://github.com/hmarr/django-debug-toolbar-mongo/zipball/master
Installing collected packages: django-debug-toolbar-mongo
Running setup.py install for django-debug-toolbar-mongo
Successfully installed django-debug-toolbar-mongo
Cleaning up...
Run Code Online (Sandbox Code Playgroud)
这样你就可以使用github源代码库进行pip工作了.
wie*_*990 26
如果你想使用requirements.txt文件,你将需要git和下面的条目类似地匿名获取你的主分支requirements.txt.
git+git://github.com/celery/django-celery.git
Run Code Online (Sandbox Code Playgroud)
-e git://github.com/celery/django-celery.git#egg=django-celery
Run Code Online (Sandbox Code Playgroud)
可编辑模式将项目的源代码下载到./src当前目录中.它允许pip freeze输出包的正确github位置.
ava*_*chy 11
像克隆任何其他项目一样克隆目标存储库:
git clone git@github.com:myuser/foo.git
Run Code Online (Sandbox Code Playgroud)
然后在开发模式下安装它:
cd foo
pip install -e .
Run Code Online (Sandbox Code Playgroud)
你可以改变你想要的任何东西,使用foo包的每个代码都将使用修改后的代码.
这个解决方案有两个好处:
.gitdir,因此它是常规的Git存储库.你可以马上推到你的前叉.pip install git+https://github.com/jkbr/httpie.git
Run Code Online (Sandbox Code Playgroud)
pip install https://github.com/jkbr/httpie/tarball/master
Run Code Online (Sandbox Code Playgroud)
或者
pip install https://github.com/jkbr/httpie/zipball/master
Run Code Online (Sandbox Code Playgroud)
或者
pip install https://github.com/jkbr/httpie/archive/master.zip
Run Code Online (Sandbox Code Playgroud)
注意:您需要一个包含 setup.py 文件的 python 包。
| 归档时间: |
|
| 查看次数: |
147848 次 |
| 最近记录: |