问题
I am trying to convert a .py to .exe using pyinstaller. 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. 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. 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. I have python 3.6.3 installed.
回答1:
Please see this link: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.
If you are using anaconda3 this can be done by opening a command prompt and running:
conda update conda
And then running:
conda install python=3.5
回答2:
It's better to build a different environment for when wanting to make an executable python file. This should work to the python version your executable compiler works better. Usually, the older the python version the easiest is to compile.
回答3:
The way suggested by alphabet5 took too long for me. I wanted to find another way.
What I did was to create another environment for Python3.5
in Anaconda Navigator. Then, I activated the Python3.5
environment (for example py35):
conda activate py35
Then, I installed necessary libraries such as pyqt5
, pyqtgraph
, pyinstaller
etc. since py35 is a newly created environment.
When I ran pyinstaller
and didn't get any error.
来源:https://stackoverflow.com/questions/51012750/pyinstaller-recursion-error-maximum-recursion-depth-exceeded