pip freeze

Create a requirements file that contain all your project dependencies

pip freeze > requirements.txt

Install your project requirements (if a requirements file exist)

pip install -r requirements.txt


To only includes libraries that are used, use pipreqs:

pip install pipreqs

create requirements.txt for project directory:

pipreqs project

create requirements.txt in current directory:

pipreqs .