使用 pip freeze 生成
一般情况,我们可以直接使用Python下的 pip 包管理工具,来生成 requirements.txt 文件,命令如下:
pip freeze > path\requirements.txt
其中,path为生成的 requirements.txt 文件的具体路径。通过这个 pip freeze 方式生成时,会把整个Python环境下的所有包都列出生成,比较适用于Python项目为虚拟环境的情况。
使用 pip freeze 生成
一般情况,我们可以直接使用Python下的 pip 包管理工具,来生成 requirements.txt 文件,命令如下:
pip freeze > path\requirements.txt
其中,path为生成的 requirements.txt 文件的具体路径。通过这个 pip freeze 方式生成时,会把整个Python环境下的所有包都列出生成,比较适用于Python项目为虚拟环境的情况。