Find python project dependencies and generate requirements.txt

 

 

 

1. If you use a virtualenv environment, use pip freeze > requirements.txt directly

➜  ~ .virtualenvs/xxx/bin/pip freeze > requirements.txt

2. If virtualenv is not used, use the tool pipreqs

  The advantage of this tool is that it can automatically discover which class libraries are used by scanning the project directory, and automatically generate a dependency list. The disadvantage is that there may be some deviations, which need to be checked and adjusted by yourself.

install # pip install pipreqs

Use, enter the project directory and execute # pipreqs ./ to automatically generate the requirements.txt file in the current directory

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326256101&siteId=291194637