Use requirements.txt

1. Generate requirements.txt

  • Use pip freeze

Applicable to the case of a single virtual environment.

It will add all the dependencies in the environment.

1
pip freeze > requirements.txt
  • Use pipreqs (Recommend)

It will only add dependencies in the current environment.

1
pip install pipreqs
1
pipreqs . --encoding=utf8 --force

2. Install requirements.txt

1
pip install -r requirements.txt

Use requirements.txt
https://www.hardyhu.cn/2022/06/08/Use-requirements-txt/
Author
John Doe
Posted on
June 8, 2022
Licensed under