在打包包含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
ok
可以運行
更多打包講解
python將資源檔案一起打包進exe 講解(有算例)

電氣專業的計算機萌新:余登武,寫博文不容易,如果你覺得本文對你有用,請點個贊支持下,謝謝,

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/143280.html
標籤:其他
上一篇:emif埠
