首页 > 解决方案 > Pyinstaller RecursionError: maximum recursion depth exceeded

问题描述

I got the following problem, that if I try to generate an exe using pyinstaller I get the following error message:

RecursionError: maximum recursion depth exceeded while calling a Python object

I found a lot of solutions saying that I should add

import sys
sys.setrecursionlimit(5000)

into the .spec file which is generated. Doing that the .exe is generated successfully. But if I then try to run the .exe I get the following error:

Failed to execute script pyi_rth_pkgres

Tried a lot of different solutions provided in other posts but none worked. Is there anybody who has an idea how to fix it? I'm using

PyInstaller: 3.6
Python: 3.7.6 (conda)

On Another computer I had an older version of Python and Pyinstaller installed and over there it worked perfectly fine with the same script.

标签: pythonrecursionpyinstaller

解决方案


尝试选项--onefile。如果可能,尽量简化您的代码(例如,使用模块而不是单个文件等)


推荐阅读