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.

解决方案:

加入以下语句:

import matplotlib as mpl
import matplotlib.pyplot as plt
mpl.use(‘TkAgg’)

但是我加入以后还是无法显示图片,原因在于mpl.use(‘TkAgg’)语句要在导入所有包之后即最后加。

你可能感兴趣的:(python,python)