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
在打包包含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

完成!

Original: https://blog.csdn.net/Zinnir/article/details/122724599
Author: hi_1900
Title: python打包exe出现RuntimeError: Could not find the matplotlib data files 的解决方法

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/765830/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球