How to pip install git repository with requirements

a 夏天 提交于 2020-07-09 07:49:06

问题


So I have a common library repository which looks something like:

common
    __init__.py
    foo
        __init__.py
        bar.py
README.md
requirements.txt
setup.py

In a separate project I have it in requirements.txt like this:

git+https://github.com/something/something.git#egg=common

When I do pip install it installs it to:

venv
    src
        common

The problem is, the common library has its own requirements.txt file.

How to tell pip to install requirements of the external library?


回答1:


When you pip install it uses setup.py of the downloaded package to find dependencies, as opposed to running "-r requirements.txt".

Changing the setup.py of common to define dependencies is what you're after.

For an example of defining install_requires in your setup.py file, see the Hitchhiker's Guide to Packaging.




回答2:


pip -r <file|url> supports eitehr a local file or a url. e.g:

pip install -r http://localhost:8080/requirements.txt

Tested and confirmed.



来源:https://stackoverflow.com/questions/20578146/how-to-pip-install-git-repository-with-requirements

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