python超简单_requirements.txt的生成和安装

论坛 期权论坛 编程之家     
选择匿名的用户   2021-5-30 20:41   30   0

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

pip install -r requirements.txt

如果想要更快,可以使用清华园镜像 https://pypi.tuna.tsinghua.edu.cn/simple

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

使用 pipreqs 生成requirement.txt,可以直接pip安装,也可以去github是下载安装,github地址为: https://github.com/bndr/pipreqs

pip install pipreqs

到需要生成requirement.txt的路径下,输入以下指令

pipreqs . --encoding=utf8 --force

注意 --encoding=utf8 为使用utf8编码,不然可能会报UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 406: illegal multibyte sequence 的错误。

--force 强制执行,当 生成目录下的requirements.txt存在时覆盖。

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP