pip

Generate requirements.txt

  1. Recored the package name

  2. Run the following command to generate a requirements.txt file: pip freeze | grep PKG_NAME >> requirements.txt

Another way to generate requirements.txt file is to use the pipreqs package.

  1. Install the package using the following command: pip install pipreqs

  2. Run pipreqs command in the directory where the project is located: pipreqs

Note that the pipreqs package may not list all the packages that are installed in the virtual environment.

Last updated