python 打包exe出现RuntimeError: Could not find the matplotlib data files 的解决方法

   日期:2020-10-01     浏览:666    评论:0    
核心提示:在打包包含matplotlib库时出现RuntimeError: Could not find the matplotlib data files的解决方法。错误提示里面的介绍:MatplotlibDeprecationWarning: Matplotlib installs where the data is not in the mpl-data subdirectory of the package are deprecated since 3.2 and support for them

在打包包含matplotlib库时出现RuntimeError: Could not find the matplotlib data files的解决方法。

错误提示里面的介绍:

MatplotlibDeprecationWarning: Matplotlib installs where the data is not in the mpl-data subdirectory of the package are deprecated since 3.2 and support for them will be removed two minor releases later.

原因 matplotlib3.2以后就把mpl-data分离出去了

所以解决方法
第一步:卸载,重装(在anaconda prompt里)或者虚拟环境下,看你在哪里打包,就在哪里装

pip uninstall matplotlib
pip install matplotlib==3.1.1

第二步:打包

pyinstaller -F XXX.py

第三步:修改spec文件
原hiddenimports=[],
修改后
hiddenimports=[‘matplotlib’],

第四步:重新打包

pyinstaller -F XXX.spec

ok
可以运行

更多打包讲解
python将资源文件一起打包进exe 讲解(有算例)


电气专业的计算机萌新:余登武。写博文不容易。如果你觉得本文对你有用,请点个赞支持下,谢谢。

 
打赏
 本文转载自:网络 
所有权利归属于原作者,如文章来源标示错误或侵犯了您的权利请联系微信13520258486
更多>最近资讯中心
更多>最新资讯中心
0相关评论

推荐图文
推荐资讯中心
点击排行
最新信息
新手指南
采购商服务
供应商服务
交易安全
关注我们
手机网站:
新浪微博:
微信关注:

13520258486

周一至周五 9:00-18:00
(其他时间联系在线客服)

24小时在线客服