Python项目第三方依赖包生成requirements.txt的两种方法

第一种 适用于单虚拟环境的情况,会将所有包一起生成不推荐

pip freeze > requirements.txt

第二种 (推荐)使用pipreqs

1. pip install pipreqs    #安装

2. pipreqs . --encoding=utf8 --force  # --encoding=utf8 为使用utf8编码  --force 强制执行,当 生成目录下的requirements.txt存在时覆盖。

安装 

使用requirements.txt安装依赖的方式:

pip install -r requirements.txt -i 临时源地址

国内源

 

清华:https://pypi.tuna.tsinghua.edu.cn/simple

 

阿里云:http://mirrors.aliyun.com/pypi/simple/

 

中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/

 

华中理工大学:http://pypi.hustunique.com/

 

山东理工大学:http://pypi.sdutlinux.org/

 

豆瓣:http://pypi.douban.com/simple/

 

posted @ 2021-07-11 20:06  mik99  阅读(197)  评论(0编辑  收藏  举报