简体   繁体   English

pyinstaller 递归错误:超出最大递归深度

[英]pyinstaller Recursion error: maximum recursion depth exceeded

I am trying to convert a .py to .exe using pyinstaller.我正在尝试使用 pyinstaller 将 .py 转换为 .exe。 When I type pyinstaller my_code.py everything seems to be working and after a couple of minutes the process stops and I get the recursion error.当我输入 pyinstaller my_code.py 时,一切似乎都在工作,几分钟后该过程停止并出现递归错误。 I have tried to create a my_code.spec file in the same folder, edit it and change the number of recursions but when I run pyinstaller apparently a new .spec is created since I can't find the sys.setrecursionlimit() command that I had previously added to the my_code.spec file.我试图在同一个文件夹中创建一个 my_code.spec 文件,对其进行编辑并更改递归次数,但是当我运行 pyinstaller 时,显然创建了一个新的 .spec,因为我找不到我的 sys.setrecursionlimit() 命令之前已添加到 my_code.spec 文件中。 I am running all the above from the anaconda command prompt and not from the command line but I think that this is not a problem since I have tried to convert to .exe a simple "hello world" script and it works perfectly.我正在从 anaconda 命令提示符而不是从命令行运行上述所有内容,但我认为这不是问题,因为我已尝试将一个简单的“hello world”脚本转换为 .exe 并且它运行良好。 I have python 3.6.3 installed.我安装了 python 3.6.3。

Please see this link: https://github.com/pyinstaller/pyinstaller/issues/2919请参阅此链接: https : //github.com/pyinstaller/pyinstaller/issues/2919

The issue is with python 3.6, and most issues can be resolved by downgrading to python 3.5 to use pyinstaller.问题出在 python 3.6 上,大多数问题都可以通过降级到 python 3.5 来使用 pyinstaller 来解决。

If you are using anaconda3 this can be done by opening a command prompt and running:如果您使用的是 anaconda3,这可以通过打开命令提示符并运行来完成:

conda update conda

And then running:然后运行:

conda install python=3.5

It's better to build a different environment for when wanting to make an executable python file.当想要制作可执行的python文件时,最好构建一个不同的环境。 This should work to the python version your executable compiler works better.这应该适用于您的可执行编译器更好的 python 版本。 Usually, the older the python version the easiest is to compile.通常,较旧的python 版本最容易编译。

The way suggested by alphabet5 took too long for me.字母表5建议的方式对我来说太长了。 I wanted to find another way.我想找到另一种方式。

What I did was to create another environment for Python3.5 in Anaconda Navigator .我所做的是在Anaconda Navigator 中Python3.5创建另一个环境。 Then, I activated the Python3.5 environment (for example py35 ):然后,我激活了Python3.5环境(例如py35 ):

conda activate py35

Then, I installed necessary libraries such as pyqt5 , pyqtgraph , pyinstaller etc. since py35 is a newly created environment.然后,我安装了必要的库,如pyqt5pyqtgraphpyinstaller等,因为py35是一个新创建的环境。

When I ran pyinstaller and didn't get any error.当我运行pyinstaller并且没有收到任何错误时。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM