How to add git source in requirements.txt

▼魔方 西西 提交于 2020-01-16 10:36:11

问题


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.

I have tried adding a configuration in ~/.config/pip/pip.conf

[global]
find-links =
    git+<REPO_LINK>

but this happened when running pip install -r requirements.txt:

ERROR: Could not find a version that satisfies the requirement my-package==0.1

Thanks in advance.


回答1:


I have found a solution for it at this doc.

pip install git+<REPO_LINK>#egg=<PACKAGE_NAME>

When I run pip freeze, the package I have just installed is printed like this:

git+<REPO_LINK>#egg=<PACKAGE_NAME>

So running pip install -r requirements.txt runs like a charm to install this specific package so as public ones from Pypi.

:)



来源:https://stackoverflow.com/questions/56989529/how-to-add-git-source-in-requirements-txt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!