Menu Close

How to automatically create requirements.txt with Python?

Sometimes, we want to automatically create requirements.txt with Python.

In this article, we’ll look at how to automatically create requirements.txt with Python.

How to automatically create requirements.txt with Python?

To automatically create requirements.txt with Python, we can use the pipreqs package.

To install it, we run

pip install pipreqs

Then we create the requirements.txt file for a project with

pipreqs /path/to/project

pipreqs only saves the dependencies required by the project.

Conclusion

To automatically create requirements.txt with Python, we can use the pipreqs package.

Posted in Python, Python Answers