Matplotlib is currently using agg

问题报错

pyplot存在大量绘图时报以下错误:

1
Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure

解决方案

在报出异常的py文件中导包末尾部分追加

1
2
import matplotlib
matplotlib.use('TkAgg')