简体   繁体   中英

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:

  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. This problem arises when using the CARLA simulator. There were a couple of suggested fixes like adding the backend_tkagg import before the pyplot import but it didn't fix the problem.

It seems that matplotlib has changed some things. According to the documentation you should use tkagg.FigureCanvasTkAgg.blit instead of tkagg.blit (assuming that you import matplotlib.backends.backend_tkagg as tkagg ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM