Automatically create file 'requirements.txt'
dependencies, python, python-import, requirements.txt
Solution
Use Pipenv or other tools is recommended for improving your development flow.
pip3 freeze > requirements.txt # Python3
pip freeze > requirements.txt # Python2
If you do not use a virtual environment, pigar will be a good choice for you.
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?
Related problems
- Pipreqs: UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 1206: character maps to <undefined>
- pip freeze creates some weird path instead of the package version
- From virtualenv, pip freeze > requirements.txt give TONES of garbage! How to trim it out?
- Pip freeze for packages installed with --target