引言
在上一篇文章介绍了,如何创建python
工程的虚拟环境,那么我们在迁移的过程中,迁移使用的依赖也是必须要做的一件事情,那么我们是怎么迁移依赖的呢?
安装依赖
首先需要激活python
工程的虚拟环境;
(venv) D:\CodeBase\auto\python-server>pip install flask
导出依赖
使用requirements.txt
记录所有依赖包及其精确的版本号
(venv) D:\CodeBase\auto\python-server>pip freeze > requirements.txt
在环境副本安装依赖
创建环境副本(安装requirements.txt
记录的依赖包)
(venv) D:\CodeBase\auto\python-server>pip install -r requirements.txt