运行环境
-
操作系统:Windows10
-
pyinstaller版本:3.6
打包成一个文件
pyinstaller app.py --onefile
默认--onedir会生成一个目录, --onefile 简写 -F, --onedir 简写 -D
设置图标
pyinstaller app.py --icon app.ico
图标必须得是.ico格式否则无效一个png转.ico格式的工具
添加额外的静态资源
pyinstaller app.py --add-data templates --add-data static
打包多个可执行文件
pyinstaller app.py helper.py --onefile
打包结果是一个app.exe文件, 执行会按照顺序执行app.py 和 helper.py两个脚本
如何调试
pyinstaller app.py --debug --log-level DEBUG
--debug让可执行程序显示日志信息