Gregg's MOTD

Tips & Tricks that I've Encountered Over the Years...

Creating a Python requirements.txt File

July 02, 2023 — Gregg Szumowski

This can be done quickly by typing:

$ pip freeze >requirements.txt

at the command line.

To install packages using a requirements file just use pip:

$ pip install -r requirements.txt

To check if the packages in your requirements.txt file are up-to-date use:

$ pip list --outdated

and to update those packages:

$ pip install -U <packagename>

This process has some drawbacks as packages are sometimes included that are no longer needed and should only be used initially and then maintained manually.

Tags: cli, python, pip, requirements, motd