What solved the problem for me was to restart my kernel, import the following first:import matplotlibmatplotlib.use('TKAgg') 然后, import matplotlib.pyplot as plt 在尝试更改为TKAgg之前,您可能已使用其他框架导入了matplotlib.重新启动内核.You probably imported matplotlib with another framework before you tried to change to TKAgg. Restart your kernel. 这篇关于ImportError:无法加载需要"tk"交互式框架的后端"TkAgg",因为当前正在运行“无头"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-31 07:15