Python package is a container for to store multiple python modules. We can install packages in python using pip package manager. In this article we will learn to install multiple packages at once using the requirements.txt file. The requirements.txt file is useful to install all packages at once for a project, it is easy to handover to other developers and we can use this to install different versions of packages for different python projects.
The classic way of installing packages in python using pip:
pip install package_name1, package_name2
Installing python packages using requirements.txt file:
We will define each package in a new line in the requirements.txt file.
Let’s say below three python packages we defined in the requirements.txt file.
- pandas
- pillow
- numpy
We will install packages using the below command. Run the below command where the requirements.txt file is present.
pip install -r requirements.txt
PIP will download and install all packages present in that file.