Monday, November 27, 2017

Bulk Install Python Libraries with a Single Command

Hello there,
Assuming you have a situation where you needed to install numerous library dependency on your python environment to be able to run an app. You can install the libraries one after the other using: pip install library_name.

However, where you where you have many libraries to install, then a handy command will be to run it once and installed all the dependency libraries without repeating same command/process over and over again.

Here I needed to install about 20 libraries so instead of doing one thing 20 times, i will use thais command to install all sequentially: pip install -r requirements.txt

How it works
First create a text file name it requirements.txt and type all the libraries with there versions as seen below...

Next, open cmd/terminal and run pip install -r requirements.txt

This will install all the libraries as typed in the requirements.txt text file.

That is it!

No comments:

Post a Comment