python生成项目所需依赖文件

1.使用 pip freeze

pip freeze > requirements.txt

这个会把整个环境的包都列出来,适合virtualenv虚拟环境。

2.使用 pipreqs

这个工具会对项目目录进行扫描,自动发现使用了哪些库,生成依赖清单。

安装:

pip install pipreqs

进入项目目录执行命令:

pipreqs ./

然后自动在当前目录生成requirements.txt文件。

当初执行pipreqs ./命令时出现‘UnicodeDecodeError: 'gbk' codec can't decode byte 0x82 in position 783: illegal multibyte sequence’这个错误

找到pipreqs.py这个文件,将编码方式改为utf-8

问题解决

猜你喜欢

转载自blog.csdn.net/qq_42336558/article/details/84313205
今日推荐