[Python] matplotlib 提示错误 module ‘backend_interagg’ has no attribute ‘FigureCanvas’
实干、实践、积累、思考、创新。 Python编程,采用matplotlib绘图,提示一下错误: AttributeError: module ‘backend_interagg’ has no attribute ‘FigureCanvas’. Did you mean: ‘FigureCanvasAgg’? 如下图所示: 根据提示,错误原因是没有设置FigureCanvas参数,该参数用于指定matplotlib的绘图后端参数backen,经查询,采用以下三句代码引用matplotlib库即可解决问题 import matplotlib matplotlib.use(‘TkAgg’) import matplotlib.pyplot as plt 即在使用matplotlib库前,先直接指定backen参数,其中,matplotlib的backen参数有以下可选项 [‘GTK3Agg’, ‘GTK3Cairo’, ‘GTK4Agg’, ‘GTK4Cairo’, ‘MacOSX’, ‘nbAgg’, ‘QtAgg’, …
![Grasshopper建筑结构参数化建模应用实例[Practical Examples of Parametric Modeling for Building Structures Using Grasshopper]](http://www.jdcui.com/wp-content/uploads/2026/01/封面.png)