pip list --format=freeze > requirements.txt
For Unix families: pip3 freeze > requirements.txt
For Windos: pip freeze > requirements.txt
# install
pip3 install pipreqs
# Run in current directory
python3 -m pipreqs.pipreqs .
pip3 freeze > requirements.txt # Python3
pip freeze > requirements.txt # Python2
pip3 freeze > requirements.txt
# You can use the following code to generate a requirements.txt file:
> pip install pipreqs
> pipreqs /path/to/project
# other popular way
> pip freeze
# pip freeze saves all packages in the environment including those that
# you don't use in your current project. (so use wisely)
# install
pip install --upgrade pipreqs
# run
python -m pipreqs.pipreqs . --force