pyinstaller打包python文件出现"RuntimeError: maximum recursion depth exceeded in comparison "错误解决方案

一、出现原因:

python默认迭代次数有限(大概是1000左右),如果你引用了plot画图,或者某个循环方法超出此限制,就会报这个错误

二、解决方法:

打包失败,也会生成一个spec文件,如你的主python文件叫做main.py,则修改main.spec:

添加代码行:import sys
                                    sys.setrecursionlimit(1000000)

注意:是spec文件,作用是提高迭代深度限制到1000000

然后在命令行中用此spec文件打包python程序:pyinstaller main.spec

执行命令,成功

 

猜你喜欢

转载自blog.csdn.net/qq_42063091/article/details/82423003