报错 Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure. 解决方法
运行程序时报错:Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure. 具体如图:

当我们有这个报错时就看不到图像输出,所以我们必须安装GUI后端(也就是图形用户界面),通过这个GUI接口我们可以与设备交互以及可视化绘图。
Python中有很多方式来扩展GUI,最常见的方式是Tkinter
1、Ubuntu下安装Tkinter来解决该问题: sudo apt-get install python3-tk

2、另一种方法是安装PyQt5
sudo apt-get install python3-pyqt5

浙公网安备 33010602011771号