使用 管理项目依赖

导出:

将项目中使用的第3方工具包名称及版本号导出至1个名requirements.txt的文件

pip freeze > requirements.txt

安装:

激活虚拟环境(不激活虚拟环境,会在python全局安装)--可省略

workon autotest 

在虚拟环境中安装requirements.txt中的依赖依赖

pip install -r requirements.txt

如果不小心把依赖都安装在了全局python环境,使用下面的命令恢复环境

pip uninstall -r requirements.txt

python搭建虚拟环境,参照:Windows环境搭建python虚拟环境 

原文地址:https://www.cnblogs.com/kaerxifa/p/12858017.html