Matplotlib之无GUI时的解决办法 需添加: import matplotlib as mpl mpl.use('Agg') 而且必须添加在import matplotlib.pyplot之前,否则无效