# from PyInstaller.utils.hooks import exec_statement # # mpl_data_dir = exec_statement( # "import matplotlib; print(matplotlib.get_data_path())") # assert mpl_data_dir, "Failed to determine matplotlib's data directory!" # # datas = [ # (mpl_data_dir, "matplotlib/mpl-data"), # ] 改成下面 import matplotlib mpl_data_dir = matplotlib.get_data_path() datas = [ (mpl_data_dir, "matplotlib/mpl-data"), ]
pyinstaller -F -w main.py