pyinstaller打包报错: RecursionError: maximum recursion depth exceeded 已经解决

时间:2023-03-10 07:17:33
pyinstaller打包报错: RecursionError: maximum recursion depth exceeded 已经解决

看上去似乎是某个库自己递归遍历超过了python的栈高度限制

搜索了一番,很快找到了解决办法: https://*.com/questions/38977929/pyinstaller-creating-exe-runtimeerror-maximum-recursion-depth-exceeded-while-ca

在此总结下解决步骤:

1)pyinstaller -F xxx.py

这一步肯定会报上述错误导致失败,但是会产生一个xxx.spec文件

2)在xxx.spec文件中增加两行(添加在原文件第二行):

import sys
sys.setrecursionlimit(5000)
3)pyinstaller xxx.spec

打包成功。