python生成requirements.txt的方法

生成requirements.txt的方法

1、pipreqs

pipreqs命令可以根据imports自动生成这样一个requirements.txt文件,只导出当前项目下用到的类库。

pip3 install pipreqs

pipreqs ./

2、pip freeze

pip freeze可以拉取环境中所有的包,即导出当前环境下Python安装的所有类库。

pip freeze > requirements.txt

ps: 使用requirements.txt安装类库

pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/

你可能感兴趣的:(python自动化测试,pipreqs,pipfreeze,Python,项目依赖)