Matplotlib is currently using agg, which is a non-GUI backend

按照网上的解决办法添加

import matplotlib

matplotlib.use('TkAgg')

import matplotlib.pyplot as plt

提示ImportError: No module named '_tkinter', please install the python3-tk package

于是,在terminal输入以下命令

sudo apt install tk-dev 

sudo apt search python3-tk

sudo apt install python3-tk

如果上述办法无效,可以把图像先保存起来,在后端查看

plt.savefig('test.png')

 

你可能感兴趣的:(编译错误)