命令样式:
pyinstaller -w -i “d:\my.ico” -F mypy.py
递归超过了python的栈高度限制
File "F:\Program_File\anaconda3\lib\ast.py", line 263, in generic_visit
self.visit(value)
File "F:\Program_File\anaconda3\lib\ast.py", line 253, in visit
return visitor(node)
RecursionError: maximum recursion depth exceeded
stackoverflow网友解决方案
Mustafa did guide me to the right direction, you have to increase the recursion limit. But the code has to be put to the beginning of the spec file and not in your python code:
import sys
sys.setrecursionlimit(5000)
Create the spec file with pyi-makespec first, edit it and then build by passing the spec file to the pyinstaller command. See the pyinstaller manual for more information about using spec files.
Please make sure to use pyinstaller 3.2.0, with 3.2.1 you will get ImportError: cannot import name ‘is_module_satisfies’ (see the issue on GitHub)
在此总结下解决步骤:
1)pyinstaller -F xxx.py
这一步肯定会报上述错误导致失败,但是会产生一个xxx.spec文件
2)在xxx.spec文件中增加两行(添加在原文件第二行):
import sys
sys.setrecursionlimit(5000)
再执行 pyinstaller xxx.spec 打包成功。
Exception:
Cannot find existing PyQt5 plugin directories
Paths checked: C:/qt64/qt_1544645195969/_h_env/Library/plugins
网友方案
I solved it by copying the pyqt5qmlplugin.dll to the path mentioned above C:/qt64/qt_1544645195969/_h_env/Library/plugins. Finally I got the .exe
意思就是:
----------------------------------------
'utf-8' codec can't decode byte 0xce in position 123: invalid continuation byte
These are the bytes around the offending byte:
思路:编码格式问题(可直接解决问题)
如果还不行:
尝试将中文解释都去掉
This application failed to start because it could not find or load the Qt platform plugin “windows”.
吧这个文件夹,拷贝到执行程序同目录即可:
如果是anaconda环境,
c:\Program_File\anaconda3\Library\plugins\platforms
如果是python 环境:
C:\Python33\Lib\site-packages\PyQt5\plugins\platforms
这个问题纠结了我两天,最终解决了
(venv) D:\pyvenv_a\venv>pyinstaller -F pyexcel\RWExcel.py pyexcel\operfile.py
......
1135 INFO: Bootloader d:\pyvenv_a\venv\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
21135 INFO: checking EXE
21139 INFO: Building because toc changed
21140 INFO: Building EXE from EXE-00.toc
21141 INFO: Appending archive to EXE D:\pyvenv_a\venv\dist\RWExcel.exe
21169 INFO: Building EXE from EXE-00.toc completed successfully.
已经很小了,40M左右,(本身里边包含python解析器信息,基本都会大于10M)