在打包包含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分离出去了
所以解决方法
第一步:卸载,重装(我是在pycharm下)或者虚拟环境下,看你在哪里打包,就在哪里装
pip uninstall matplotlib
pip install matplotlib==3.1.1
第二步:打包
pyinstaller -F XXX.py
一次成功!
不过我事先降级了setuptools,好像要降到44一下,我降到了39
当使用matplotlib3.2及以上版本打包时,可能会遇到RuntimeError,因为数据文件被移出。解决方法是先卸载matplotlib,然后安装3.1.1版本,并确保setuptools版本在44以下。执行pip uninstall matplotlib,再用pip install matplotlib==3.1.1,最后使用pyinstaller打包即可成功。

被折叠的 条评论
为什么被折叠?



