import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
plt.plot([1,2,3,4])
plt.ylabel('some numbers')
plt.show()
运行上述代码,得出以下错误
ImportError: Cannot load backend 'TkAgg' which requires the 'tk' interactive framework, as 'headless' is currently running
matplotlib的版本号是3.2.2,
调用 matplot.get_backend()
得到结果'agg'
但是使用conda list
命令还是可以看到tk包已经安装了