UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figur

问题:UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure

图像出不来,估计是matplotlib版本的原因

如果不想卸载重装matplotlib

就用以下代码代替解决。

解决办法如下:

把import matplotlib.pyplot as plt用下面这些代码代替,问题得到解决

import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt

猜你喜欢

转载自blog.csdn.net/li1873997/article/details/133800569