问题描述
我想从私有git存储库中安装某些软件包.使用pip install git+<REPO_LINK>
可以做到这一点.但是,我想同时pip install -r requirements.txt
我所有的软件包,而不必指定哪个软件包来自Pypi和私人仓库.
I would like to install a certain package from a private git repository. This is possible using pip install git+<REPO_LINK>
. However, I would like to pip install -r requirements.txt
all of my packages at the same time without having to specify which one comes from Pypi and private repo.
我尝试在~/.config/pip/pip.conf
[global]
find-links =
git+<REPO_LINK>
但这是在运行pip install -r requirements.txt
时发生的:
but this happened when running pip install -r requirements.txt
:
ERROR: Could not find a version that satisfies the requirement my-package==0.1
谢谢.
推荐答案
我已经找到了解决方案此文档.
I have found a solution for it at this doc.
pip install git+<REPO_LINK>#egg=<PACKAGE_NAME>
当我运行pip freeze
时,我刚刚安装的软件包将打印如下:
When I run pip freeze
, the package I have just installed is printed like this:
git+<REPO_LINK>#egg=<PACKAGE_NAME>
因此,运行pip install -r requirements.txt
就像安装Pypi的公共软件包一样,很容易安装此特定软件包.
So running pip install -r requirements.txt
runs like a charm to install this specific package so as public ones from Pypi.
:)
这篇关于如何在requirements.txt中添加git源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!