Matplotlib is currently using agg, which is a non-GUI backend 和 ImportError: No module named 'Tkinter' [closed]

跑maskrcnn报错:UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
% get_backend())
可以在第一部分增加一行代码:
matplotlib.use(‘TkAgg’)

最后显示如下:

import matplotlib

matplotlib.use('TkAgg')

import matplotlib.pyplot as plt

于是尝试直接安装tkinter,结果没有发现tkinter包

linuxidc@linuxidc:~$ pip3 install tkinter

于是,执行terminal 命令:

linuxidc@linuxidc:~/linuxidc.com$ python3 -m tkinter

linuxidc@linuxidc:~$ sudo apt search python3-tk

linuxidc@linuxidc:~$ sudo apt install python3-tk

在安装完成之后,重新执行程序,然后报出同样的错误,问题仍然存在。

r如果发现有信息说,需要安装tk的开发类库,直接进行安装:

sudo apt install tk-dev (Ubuntu/Debian)

yum install tk-devel (CentOS)

猜你喜欢

转载自www.cnblogs.com/HHHAI/p/11200286.html