python 测试matplotlib时出现如下报错,还请大神指点思路,

import matplotlib.pyplot as plt
#准备绘制的两个点(0,2)与(1,4)连线

#调用绘制plot方法
x=[1,2,3,4,5]
y=[1,4,9,16,25]
plt.plot(x,y,linewidth=5)
plt.xlabel('x',fontsize=14)
plt.ylabel('y=x^2',fontsize=14)
plt.rcParams['font.sans-serif']=['SimHei']
plt.title('图表绘制')
# 显示绘制的图
plt.show()

run时出现如下错误,还请大神们指点一二,谢谢!!

Traceback (most recent call last):
  File "D:\python\opentest\plt.py", line 7, in
    plt.plot(x,y)
  File "C:\Python39\lib\site-packages\matplotlib\pyplot.py", line 2728, in plot
    return gca().plot(
  File "C:\Python39\lib\site-packages\matplotlib\pyplot.py", line 2225, in gca
    return gcf().gca()
  File "C:\Python39\lib\site-packages\matplotlib\pyplot.py", line 830, in gcf
    return figure()
  File "C:\Python39\lib\site-packages\matplotlib\_api\deprecation.py", line 454, in wrapper
    return func(*args, **kwargs)
  File "C:\Python39\lib\site-packages\matplotlib\pyplot.py", line 771, in figure
    manager = new_figure_manager(
  File "C:\Python39\lib\site-packages\matplotlib\pyplot.py", line 346, in new_figure_manager
    _warn_if_gui_out_of_main_thread()
  File "C:\Python39\lib\site-packages\matplotlib\pyplot.py", line 336, in _warn_if_gui_out_of_main_thread
    if (_get_required_interactive_framework(_get_backend_mod()) and
  File "C:\Python39\lib\site-packages\matplotlib\pyplot.py", line 206, in _get_backend_mod
    switch_backend(dict.__getitem__(rcParams, "backend"))
  File "C:\Python39\lib\site-packages\matplotlib\pyplot.py", line 266, in switch_backend
    canvas_class = backend_mod.FigureCanvas
AttributeError: module 'backend_interagg' has no attribute 'FigureCanvas'

你可能感兴趣的:(matplotlib,python,开发语言)