Does python pip have the equivalent of node's package.json? Does python pip have the equivalent of node's package.json? node.js node.js

Does python pip have the equivalent of node's package.json?


Once all necessary packages are added

pip freeze > requirements.txt

creates a requirement file.

pip install -r requirements.txt

installs those packages again, say during production.


Yes, it's called the requirements file:

https://pip.pypa.io/en/stable/cli/pip_install/#requirement-specifiers

You can specify the package name & version number.

You can also specify a git url or a local path.

In the usual case, you would specify the package followed by the version number, e.g.

sqlalchemy=1.0.1

You can install all the packages specified in a requirements.txt file through the command

pip install -r requirements.txt


Once all the packages have been installed, run

pip freeze > requirements.txt

This will save the package details in the file requirements.txt.

For installation, run

pip install -r requirements.txt

to install the packages specified by requirements.txt.