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

在打包包含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 讲解(有算例)

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

在这里插入图片描述

评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

总裁余(余登武)

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值