报错提示如下:
AttributeError: module 'backend_interagg' has no attribute 'FigureCanvas'. Did you mean: 'FigureCanvasAgg'?
这个错误通常是由于matplotlib后端设置不正确或与运行环境不兼容引起的。为了解决这个问题,我们可以尝试以下方法:
方法1:设置matplotlib后端为:交互式后端/Agg后端
import matplotlib
matplotlib.use('TkAgg') # 设置为交互式后端
import matplotlib
matplotlib.use('Agg') # 或者使用 'Agg' 后端
方法2:取消 Show plots in tool window
方法2:升级matplotlib
pip install --upgrade matplotlib