Pip Create requirements.txt and Install Python Packages – Python Tutorial

By | July 25, 2023

In this tutorial, we will introduce you how to create a requirements.txt using pip and install python packages.

Create requirements.txt

It is easy to create requirements.txt file by using pip, we can use command below:

pip freeze > requirements.txt

Then, we can see all installed python packages in your python environment.

Pip Create requirements.txt and Install Python Packages - Python Tutorial

Install python packages from requirements.txt

After we have got the requirements.txt file, we can install python packages by it.

We can use command below:

pip install -r requirements.txt

Then, all python packages in requirements.txt will be installed.