snippetpythonCritical
Automatically create file 'requirements.txt'
Viewed 0 times
requirementstxtfileautomaticallycreate
Problem
Sometimes I download the Python source code from GitHub and don't know how to install all the dependencies. If there isn't any requirements.txt file I have to create it by hand.
Given the Python source code directory, is it possible to create requirements.txt automatically from the import section?
Given the Python source code directory, is it possible to create requirements.txt automatically from the import section?
Solution
Use Pipenv or other tools is recommended for improving your development flow.
If you do not use a virtual environment, pigar will be a good choice for you.
pip3 freeze > requirements.txt # Python3
pip freeze > requirements.txt # Python2If you do not use a virtual environment, pigar will be a good choice for you.
Code Snippets
pip3 freeze > requirements.txt # Python3
pip freeze > requirements.txt # Python2Context
Stack Overflow Q#31684375, score: 1485
Revisions (0)
No revisions yet.