当前位置:网站首页>Record of problems encountered by the pyinstaller packager
Record of problems encountered by the pyinstaller packager
2022-07-30 05:02:00 【Ke Daxia loves to drink water】
pyinstallerSupported parameter functions

命令样式:
pyinstaller -w -i “d:\my.ico” -F mypy.py
python pyinstaller RecursionError: maximum recursion depth exceeded
在调用pyinstaller -F my.py 时报错如下:
Recursion exceededpython的栈高度限制
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
解决方案
stackoverflowNetizen solutions
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 打包成功.
python pyinstaller Cannot find existing PyQt5 plugin directories
问题现象
Exception:
Cannot find existing PyQt5 plugin directories
Paths checked: C:/qt64/qt_1544645195969/_h_env/Library/plugins
解决方案
Friends Program
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
意思就是:
- 手动创建C:/qt64/qt_1544645195969/_h_env/Library/plugins这个目录,
- 然后从anaconda下找到pyqt5qmlplugin.dll Copy this library into it

python pyinstaller ‘utf-8’ codec can’t decode byte 0xce in position 123: invalid continuation byte
问题现象
----------------------------------------
'utf-8' codec can't decode byte 0xce in position 123: invalid continuation byte
These are the bytes around the offending byte:
解决方案
思路:编码格式问题(directly solve the problem)
- Change the encoding format of the console to utf-8 解决方法,Type in the console first chcp 65001Toggle console encoding format,再执行打包命令
如果还不行:
Try to remove all Chinese explanations
python pyinstallerThe packager failed to start
现象
This application failed to start because it could not find or load the Qt platform plugin “windows”.
解决方案
bar this folder,Copy it to the same directory as the executable program:
如果是anaconda环境,
c:\Program_File\anaconda3\Library\plugins\platforms
如果是python 环境:
C:\Python33\Lib\site-packages\PyQt5\plugins\platforms
pyinstaller打包程序exe过大(exe 300多M)
This problem has been bothering me for two days,最终解决了
问题根源
- Mostly because we useanaconda,Then some libraries are packaged,例如 xlwings,openxlWait until the package is finished,Needless to say, go directly300M以上
- 原因是anacondaThe relationship of the library is too complicated,打包程序pyinstallerBy default, all related items are packaged in

解决方法
- The best way to do this is to create a new onepython venv,Pack in a new environment
- Refer to my other blog post for the new method: 如何新建python venv
- 新建后,调用pyinstaller 打包,The library called、Packages are all newvenv中的,和anaconda无关了
(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.
新建venv打包结果:
已经很小了,40M左右,(contained within itselfpython解析器信息,基本都会大于10M)
By the way, solve the above three problems
- The three problems described above,也随之不见了,All were resolved by accident
结论
- 解决以上所有问题,The best version is to create a new onepython venv,Basically can isolate many problems
- We can also infer that,编码错误、The stack arrives on-line and so onanacondaIndirect problems caused by dependent libraries,anaconda在给我们带来方便的同时,Also dug a lot of holes
边栏推荐
- Weight line segment tree + line segment tree split/merge + CF1659D
- DAY17: weak password detection and test
- Golang eight-legged text finishing (continuous handling)
- Acwing完全数
- [Android development] Splash interface / user agreement and privacy policy pop-up window / interface development
- Mini Program wx.miniProgram.navigateTo jump address cannot be tabbar address
- 1. Get data - requests.get()
- 2.6 Radix sort (bucket sort)
- 小程序npm包--API Promise化
- 模拟问题(中)
猜你喜欢

Hexagon_V65_Programmers_Reference_Manual(11)

(RCE) Remote Code/Command Execution Vulnerability Vulnerability Exercise

Repetition XXL - JOB scheduling center background arbitrary command execution

Shanxi group (enterprises) in the second network security skills competition part problem WP (7)

Discourse Custom Header Links

Unity3D Application simulation enters the front and background and pauses

七、自定义配置

Protobuf compound data types, speaking, reading and writing

The Azure developer news 丨 memorabilia in July

Code open source design and implementation ideas
随机推荐
[C language] Program environment and preprocessing
webService接口
[Android development] Splash interface / user agreement and privacy policy pop-up window / interface development
[MRCTF2020]Hello_misc
String Problem (Part 1)
Excellent MySQL interview questions, 99% must ask in preparation for August!I can't pass the interview
Naive Bayes Classification
C. Qualification Rounds
Unity3D Application simulation enters the front and background and pauses
Mini Program wx.miniProgram.navigateTo jump address cannot be tabbar address
1315_Use the LOOPBACK simulation mode to test whether the pyserial installation is successful
js operation to add or subtract from the current date (day, week, month, year)
mysql无法远程连接 Can‘t connect to MySQL server on ‘xxx.xxx.xxx.xxx‘ (10060 “Unknown error“)
小程序npm包--API Promise化
Become a qualified cybersecurity, do you know this?
Classification of decision tree classification
L2-025 分而治之
Usage of EFR32 as sniffer for Zigbee/Thread
Go study notes (84) - Go project directory structure
Some understanding of YOLOv7