在打包包含matplotlib库时出现RuntimeError: Could not find the matplotlib data files的解决方法。python
错误提示里面的介绍:spa
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..net
缘由 matplotlib3.2之后就把mpl-data分离出去了code
因此解决方法
第一步:卸载,重装(在anaconda prompt里)或者虚拟环境下,看你在哪里打包,就在哪里装
blog
pip uninstall matplotlib pip install matplotlib==3.1.1
第二步:打包图片
pyinstaller -F XXX.py
第三步:修改spec文件
原hiddenimports=[],
修改后
hiddenimports=[‘matplotlib’],
ip
第四步:从新打包资源
pyinstaller -F XXX.spec
ok
能够运行
rem
更多打包讲解
python将资源文件一块儿打包进exe 讲解(有算例)
get
电气专业的计算机萌新:余登武。写博文不容易。若是你以为本文对你有用,请点个赞支持下,谢谢。