[英]matplotlib.backends.backend_tkagg is throwing an attribute error for 'blit'
When I try to run python3 module_7.py
on my terminal, I get the following error:当我尝试在终端上运行python3 module_7.py
时,出现以下错误:
File "/opt/CarlaSimulator/PythonClient/live_plotter.py", line 227, in plot_figure
tkagg.blit(photo, fca.get_renderer()._renderer, colormode=2)
AttributeError: module 'matplotlib.backends.backend_tkagg' has no attribute 'blit'
I have checked the matplotlib installation and everything seems fine.我检查了 matplotlib 安装,一切似乎都很好。 This problem arises when using the CARLA simulator.使用 CARLA 模拟器时会出现此问题。 There were a couple of suggested fixes like adding the backend_tkagg import before the pyplot import but it didn't fix the problem.有一些建议的修复,例如在 pyplot 导入之前添加 backend_tkagg 导入,但它没有解决问题。
It seems that matplotlib has changed some things.似乎 matplotlib 改变了一些东西。 According to the documentation you should use tkagg.FigureCanvasTkAgg.blit
instead of tkagg.blit
(assuming that you import matplotlib.backends.backend_tkagg as tkagg
).根据文档,您应该使用tkagg.FigureCanvasTkAgg.blit
而不是tkagg.blit
(假设您import matplotlib.backends.backend_tkagg as tkagg
)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.