Automatically create requirements.txt

Sometimes I download python source code from github and don't know how to install all the dependencies. If there is no requirements.txt file I have to create it by hands. The question is: Given python source code directory is it possible to create requirements.txt automatically from import section?

If you use virtual environment, pip freeze > requirements.txt just fine. If not, pigar will be a good choice for you.

By the way, I do not ensure it will work with 2.6.


Pipenv is recommended for modern Python applications.