1、安装pyinstaller

    pip install pyinstaller

 

2、编译

    pyinstaller -F -w game.py  (-F表示打包单个文件,-w是为了打开exe时候不弹出黑框)

 

3、设置exe的图标

    pyinstaller -F -w -i favicon.ico ***.py  (-i用来设置编译成exe文件的图标,后面跟.ico格式的图片文

 

编译的文件在 dist/***.exe ,如果运行exe闪退,先用cmd进入exe目录,再在cmd里运行***.exe

 

相关文章:

  • 2022-01-16
  • 2022-12-23
  • 2021-06-16
  • 2021-12-22
  • 2022-02-08
  • 2022-12-23
  • 2021-06-10
  • 2021-10-13
猜你喜欢
  • 2022-12-23
  • 2021-11-18
  • 2022-12-23
  • 2021-06-16
  • 2022-12-23
  • 2021-05-19
  • 2022-12-23
相关资源
相似解决方案