[英]ModuleNotFoundError: No module named 'matplotlib.backends.backend_svg' when running exe from pyinstaller
I want to compile a python file to a standalone.exe programm using pyinstaller onefile.我想使用 pyinstaller onefile 将 python 文件编译为standalone.exe 程序。 Running the python file, everything works fine, but running the.exe file, it throws the exception运行 python 文件,一切正常,但运行 .exe 文件,它抛出异常
ModuleNotFoundError: No module named 'matplotlib.backends.backend_svg' ModuleNotFoundError:没有名为“matplotlib.backends.backend_svg”的模块
I am using schemdraw , and schemdraw uses matplotlib.我正在使用schemdraw ,而 schemdraw 使用 matplotlib。
Because I dont want matplotlib to open a window everytime I export an svg I use the backend "Agg" with matplotlib.因为我不希望 matplotlib 每次导出 svg 时都打开 window 我使用带有 ZF020313239EEEB5A654 的后端“Agg”
import matplotlib.backends.backend_tkagg
import matplotlib
matplotlib.use('Agg')
--onefile <file>
pyinstaller <file>
使用而不是 pyinstaller --onefile <file>
pyinstaller <file>
import matplotlib.backends.backend_tkagg
over import matplotlip
我尝试将import matplotlib.backends.backend_tkagg
放在import matplotlip
pip install matplotlib --upgrade --user
basicly this post .升级 matplotlib pip install matplotlib --upgrade --user
基本上这个帖子。 But since this isn't exactly my problem and none of it worked I am asking here但由于这不完全是我的问题,而且都没有奏效,我在这里问Thanks in advance提前致谢
Do you need to use Matplotlib for anything other than schemdraw?您是否需要将 Matplotlib 用于除 schemdraw 之外的任何内容? If not, you can set schemdraw to draw straight to SVG:如果没有,您可以设置 schemdraw 直接绘制到 SVG:
schemdraw.use('svg')
then it won't even go through Matplotlib.那么它甚至不会从 go 到 Matplotlib。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.