在用 pyinstaller 打包项目的时候遇到如下错误:

RecursionError: maximum recursion depth exceeded

解决方案:

  1. 执行 pyinstaller,会生成 filename.spec文件:

pyinstaller -F -w -i manage.ico filename.py

-F:打包为单文件 -w:Windows程序,不显示命令行窗口 -i:是程序图标,filename.py是你要打包的py文件

  1. 在 filename.spec 文件头添加下面语句

import sys
sys.setrecursionlimit(5000)
  1. 再次执行 pyinstaller 和 .spec文件

pyinstaller filename.spec 以上方式解决了我的问题,很适用。

 

 


 

pyinstaller设置icon图标出现“struct.error: unpack requires a buffer of 16 bytes”

我在网上找了一个喜欢的图片想把它当做图标,aaa.gif,

然后我把它改名了“icon.ico”

pyinstaller -F -i icon.ico ***.py

哦豁,报错辽:struct.error: unpack requires a buffer of 16 bytes。

解决方法:

http://ico.duduxuexi.com/” 将你的图片生成为16*16的图标文件,再试一下。

 

理由:

对于图标文件的大小和格式要求比较严格,转换一下就好。

posted on 2022-08-10 08:38  root-123  阅读(206)  评论(0编辑  收藏  举报