Explanation: Python's stack-limit is a safety-belt against endless recursion, eating up memory. PyInstaller imports modules recursively. If the structure how modules are imported within your program is awkward, this leads to the nesting being too deep and hitting Python's stack-limit. With the default recursion limit (1000), the recursion error occurs at about 115 nested imported, with limit 2000 at about 240, with limit 5000 at about 660. Build exe failed!为什么失败
时间: 2024-03-07 20:54:25 浏览: 238
该错误的原因是因为程序中有递归嵌套的模块导入,导致递归深度超过Python的堆栈限制。这会导致程序尝试使用过多的内存,最终导致构建可执行文件失败。在构建可执行文件时,PyInstaller会尝试导入程序中使用的所有模块,如果某些模块之间的导入方式不正确,则可能会导致递归深度过大。要解决这个问题,需要优化程序的模块导入结构,以确保递归深度合理,并且不会超过Python的堆栈限制。
阅读全文