A command in the python project to install the project dependency package-pipreqs tool

After getting a python project, I often encounter the situation that many dependent packages need to be installed, and it is very troublesome to install one by one.

The pipreqs tool can directly generate the requirements.txt list of all dependent packages of the project through a single command, which is convenient for deployment.

Install pipreqs;

pip install pipreqs

After installation, switch to the project root directory and execute the following command:

pipreqs ./ --encoding=utf-8 --force

If some packages are missing in the generated requirements.txt file, you can check the missing package name and manually add the package name to the file.

If this command reports an error: bash: pipreqs: command not found, enter the following command in the terminal to solve it:

/Library/Frameworks/Python.framework/Versions/3.7/bin/pipreqs
#/Library/Frameworks/Python.framework/Versions/后面的路径替换为自己电脑的
#如果没有报错,则跳过此步

(This problem has been searched on the Internet for a long time without finding a solution. Finally, I refer to this document: [Python] After pip is installed, the package reports command not found_Twish's blog-CSDN blog )

Finally, the dependent packages are automatically installed by the following command.

pip install -r requirements.txt

Guess you like

Origin blog.csdn.net/Vermouth_00/article/details/129088837