UserWarning: Matplotlib is currently using agg, which is a non-GUI backend 1 agg是一个没有图形显示界面的终端,常用的有图形界面显示的终端有TkAgg等。如下图 于是,在vscode里,Ctrl+点击matplotlib打开其_init_.py文件,将里面的Agg全部改成TkAgg,但是运行run.py还是存在该bug。 接着参考了这篇博客讲的方法。
您可以通过编辑Matplotlib的配置文件matplotlibrc来更改后端设置。这个文件通常位于Matplotlib的安装目录下,或者用户的主目录下的.matplotlib目录中。找到matplotlibrc文件后,将backend参数设置为所选的GUI后端,例如: plaintext backend: TkAgg # 或者 Qt5Agg, WXAgg 等 保存文件后,Matplotlib将使用您指定的后端。 5. 测...
plt.switch_backend('TkAgg') 1. 这将设置Matplotlib使用TkAgg渲染器。你也可以使用其他渲染器,根据你的需要进行调整。 步骤4: 检查设置结果 最后,我们需要再次检查设置结果,确保Matplotlib已经使用了正确的渲染器。可以使用以下代码再次检查当前使用的渲染器: print(plt.get_backend()) 1. 这将打印出当前使用的渲染...
1. check 在安装python时,是否勾选了tcl/tk,如果没有,请勾选上(此处浪费了我大量时间debug) 2.加入如下代码 import matplotlib matplotlib.use('TkAgg') 再次运行,成功!如下图所示:
跑maskrcnn报错:UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.% get_backend())可以在第一部分增加一行代码:matplo
报错Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure. 解决方法 import matplotlib import matplotlib.pyplot as plt matplotlib.use('tkagg')发布于 2023-03-10 11:32・上海 Python 赞同添加评论 分享喜欢收藏申请转载 ...
报错类型:Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure. 平台:Windows-pycharm-anaconda虚拟环境 解决方案: 加入以下语句: import matplotlib as mplimport matplotlib.pyplot as pltmpl.use(‘TkAgg’)#在所有包最后加入该语句即可 ...
import matplotlib # Agg backend runs without a display matplotlib.use('Agg') import matplotlib.pyplot as plt Use fig.savefig('demo.pdf') 👍 4 Hu-Charles commented May 7, 2019 • edited it doesnt work rchuso commented Jul 4, 2019 Try this: matplotlib.use( 'tkagg' ) 👍 42 ...
(2) In case there is a problem with the specific Matplotlib backend that you are using, try the following as a way to switch to another backend before issuing any other commands: importmatplotlibmatplotlib.use('TkAgg') Instead ofTkAggyou may also try other supported backends, includingQt5Agg...
调试:在每一个库import之后,加上 print(matplotlib.get_backend()) (查看当前matplotlib使用的终端类型),再次运行发现是在 from utils import visualization_utils as vis_util 后终端又变成了Agg。 遂打开visualization_utils.py在26行发现了定义了matplotlib终端类型为'Agg',修改成'TkAgg'即可。