Project development, always to build and deploy the environment, at this time, you need a python third-party package list, commonly called requirements.txt. If the project uses the VIRTUALENV environment, the PIP freeze can be used directly, but if the dependency of the project is not maintained, it will be troublesome, then we need a tool called PIPREQS, which will help us to generate the Requirements.txt file automatically.
Using PIP freeze
$ pip freeze > requirements.txt
This approach works in conjunction with VIRTUALENV, otherwise the entire package is listed in the environment.
Pipreqs
The benefit of this tool is that it is possible to automatically generate dependency manifests by scanning the project directory and automatically discovering the use of those class libraries.
The disadvantage is that there may be some deviations that need to be checked and adjusted yourself.
Usage:
Use PIPREQS in the root directory of the project.
If it is a Windows system, it will report an encoding error (unicodedecodeerror: ' GBK ' codec can ' t decode byte 0xa8 in position 24:illegal multibyte sequence)
When used, specify the encoding format pipreqs./--encoding=utf8
After generating the Requirements.txt file, you can download all dependencies based on this file
Usage: Pip Install-r requriements.txt can
PIPREQS------Find Python project dependencies and generate Requirements.txt