pip freeze > requirements.txt
# 会将环境中的依赖包全都加入
推荐方法:
pip install pipreqs
pipreqs . --encoding=utf8 --force
# --encoding=utf8
为使用utf8编码,不然windows系统 会报 UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 406: illegal multibyte sequence 的错误。
--force
强制执行,当 生成目录下的requirements.txt存在时覆盖。