Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install requirements.txt file from a python module?

I am looking for an alternative to

pip install -r requirements.txt

which can be used to install packages from a python module. I have used

subprocess.check_call([sys.executable, "-m", "pip", "install", package])

for installing a package, however, this command seems to work only for a single package. Thanks in advance. Any help is appreciated.

like image 545
Karen Avatar asked Sep 05 '25 16:09

Karen


1 Answers

Don't forget to replace "package" with "-r requirements.txt":

subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
like image 192
JBen Avatar answered Sep 07 '25 18:09

JBen