想要使用python将程序封装成exe文件,需要安装pyinstaller这个包。
第一步:安装pyinstaller包(控制台运行)
pip install pyinstaller
第二步:将程序所依赖的包导出到requirements.txt(控制台运行)
pip freeze > requirements.txt
第三步:开始对程序进行打包,打包分成多文件打包和单文件打包
多文件打包
pyinstaller -D 主程序.py
单文件打包
pyinstaller -F 主程序.py
拓展知识:
程序别名(多或单文件别名方式相同)
pyinstaller -F 主程序.py -n 别名
更新pyinstaller包
pip install --upgrade pyinstaller




还没有评论,来说两句吧...