实用Pyinstaller进行打包得到了这个错误提示
...appdata\local\programs\python\python37-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py:627: MatplotlibDeprecationWarning:
The MATPLOTLIBDATA environment variable was deprecated in Matplotlib 3.1 and will be removed in 3.3.
exec(bytecode, module.__dict__)
搜遍全网只有1种解决方案
- 删除pip uninstall matplotlib
- 然后安装
pip install 'matplotlib==3.1.1
其实还有一个解决方案
- 在本地禁用matplotlib(
matplotlib/__init__.py:625
)中的弃用警告
找到这个文件的625行
禁用警告
全部注释掉就行了。
原文地址
https://stackoverflow.com/questions/57517371/matplotlibdeprecationwarning-with-pyinstaller-exe
import os, sys
# Artificially add the MATPLOTLIBDATA environment variable. This is reset
# when you restart your python console.
os.environ["MATPLOTLIBDATA"] = os.path.join(os.path.split(sys.executable)[0], "Lib/site-packages/matplotlib/mpl-data")
# Then proceed to load matplotlib
import matplotlib