问题
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