Python_PyQt5_Poltly_cufflinks_PyQtWebEngine环境下pyinstaller打包的错误处理
背景
在用python3.6下用PyQt5.PyQtWebEngine 开发Plotly+cufflinks组件,最后利用Pyinstaller 打包时,出现了很多坑,本文记录爬坑过程和解决方案.
坑1: 缺少PyQtWebEngine
方案: 在 PyQt5 == 5.15.0下,需单独pip 安装PyQtWebEngine
坑2:引用文件上限
报错内容: RecursionError: maximum recursion depth exceeded
原因: 引用文件超出hooks上限
解决方案: 在项目目录下的 main.spec ,加入如下内容
坑3: 执行exe文件时,提示缺少plotly.validators.layout.xxx
报错内容:ModuleNotFoundError: No module named ‘plotly.validators.layout.title’
[17052] Failed to execute script main
原因: 执行程序在 程序目录寻找不到plotly下的库文件。
解决方案1: 将安装目录下的plotly文件夹整体复制到程序目录下。
解决方案2: 利用main.spec下的hidden import 指向 plotly文件夹;
(注:本人利用了方案1,方案2未使用,一个方法能解决问题,何必在创造其他问题:) )