Horje
How to install Python packages with requirements.txt

Python package is a container for storing multiple Python modules. We can install packages in Python using the pip package manager. In this article, we will learn to install multiple packages at once using the requirements.txt file. We will use the pip install requirements.txt command to install Python packages. The requirements.txt file is useful to install all packages at once for a project, it is easy to hand over 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

Here, we will see how to install Python packages using pip install requirements.txt. We will define each package in a new line in the requirements.txt file.

Let’s say below the 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.




Reffered: https://www.geeksforgeeks.org


Python

Related
Difference between Numpy array and Numpy matrix Difference between Numpy array and Numpy matrix
Count the occurrence of a certain item in an ndarray - Numpy Count the occurrence of a certain item in an ndarray - Numpy
Extract multidict values to a list in Python Extract multidict values to a list in Python
How to Add leading Zeros to a Number in Python How to Add leading Zeros to a Number in Python
Remove all columns where the entire column is null in PySpark DataFrame Remove all columns where the entire column is null in PySpark DataFrame

Type:
Geek
Category:
Coding
Sub Category:
Tutorial
Uploaded by:
Admin
Views:
12