Python生成requirements
# 1、freeze
pip freeze > requirements.txt
1
# 2、pipreqs
# 安装
pip install pipreqs
# 在当前目录生成
pipreqs . --encoding=utf8 --force
复制代码
1
2
3
4
5
2
3
4
5
注意--encoding=utf8
为使用 utf8 编码,不然可能会报 UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 406: illegal multibyte sequence 的错误。
--force
强制执行,当 生成目录下的 requirements.txt 存在时覆盖。
当当当,可以看见我依赖的只有这些啦
使用 requirements.txt 安装依赖的方式:
pip install -r requirements.txt
1
作者:
本文链接:https://jokerbai.com
版权声明:本博客所有文章除特别声明外,均采用 署名-非商业性-相同方式共享 4.0 国际 (CC-BY-NC-SA-4.0) 许可协议。转载请注明出处!
上次更新: 2025/07/19, 11:33:23
- 02
- 使用Zadig从0到1实现持续交付平台07-19
- 03
- 基于Jira的运维发布平台07-19