Python依赖管理pipreqs
2023-07-31 本文已影响0人
ShrJanLan
使用pipreqs生成requeirments.txt
安装pipreqs
pip install pipreqs
生成requirements.txt文件
pipreqs . --encoding=utf8 --force
使用pip生成当前Python项目的requirements.txt文件
pip freeze > requirements.txt
生成的文件包含一些不必要的依赖项,如系统自带的库、测试工具等,检查并删除不必要的依赖项。

编辑器自动检测requirements.txt中的依赖,不存在会提示安装依赖。
