pyinstaller打包python程序为exe

1. 安装pyinstaller

pip install pyinstaller

2. 打包为单文件

pyinstaller -F -w -i .\windowIco1.ico .\imageBrowser.py
  • -F :单文件打包
  • -w:不要console(取消类似于cmd的黑框框)
  • -i:后面接图标地址(图标一定要是标准的ico格式)

生成的exe在dist文件夹中。

3. 打包为文件夹

pyinstaller -D -w -i .\windowIco1.ico .\imageBrowser.py

生成的程序文件夹在dist目录下。

Related Posts