Split requirements files in pip

浪子不回头ぞ 提交于 2019-12-18 11:39:13

问题


To create Python virtual environments I use virtualenv and pip. The workflow is very simple:

$ virtualenv project
$ cd project
$ . bin/activate
$ pip install -r /path/to/requirements/req1.txt
$ pip install -r /path/to/requirements/req2.txt

The number of different requirement files can grow enough to make handy to have a way to include them at once, so I'd rather prefer to say:

$ pip install -r /path/to/requirements/req1_req2.txt

with req1_req2.txt containing something like:

include /path/to/requirements/req1.txt
include /path/to/requirements/req2.txt

or otherwise:

$ pip install -r /path/to/requirements/*.txt

None of that works and however much simple it could be, I can't figure out how to do what I want.

Any suggestion?


回答1:


The -r flag isn't restricted to command-line use only, it can also be used inside requirements files. So running pip install -r req-1-and-2.txt when req-1-and-2.txt contains this:

-r req-1.txt
-r req-2.txt

will install everything specified in req-1.txt and req-2.txt.



来源:https://stackoverflow.com/questions/11704287/split-requirements-files-in-pip

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