How to take a subset of python dependencies in requirements.txt
and using grep send them to pip install
?
Let's say I want to install redis
and gunicorn
only: with
cat requirements.txt | grep "redis\|gunicorn"
I get only the dependencies I want,
redis>=3.5.3
gunicorn>=20.1.0
but I would like to pass it as requirement file to pip install
.
I guess I should create a temp file with the output of grep and do something like pip install -r tempfile
, but I don't understand how to do it.
Could anyone help me?
You can use xargs
to pass the outputs to pip:
grep "redis\|gunicorn" requirements.txt | xargs pip install