模块'matplotlib'没有属性'artist',Matplotlib 3.0.0

时间:2018-10-25 02:03:13

标签: python-3.x matplotlib

这几天,我将matplotlib更新为3.0.0,但是现在出现错误: AttributeError:模块“ matplotlib”没有属性“ artist”

代码:

import matplotlib
import matplotlib.pyplot as plt
import numpy as np

# Data for plotting
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2 * np.pi * t)

fig, ax = plt.subplots()
ax.plot(t, s)

ax.set(xlabel='time (s)', ylabel='voltage (mV)',
       title='About as simple as it gets, folks')
ax.grid()

fig.savefig("test.png")
plt.show()

我使用Python 3.6.7,Windows 10,Spyder,任何想法。

当我在终端中运行时:

Traceback (most recent call last):
  File "temas.py", line 7, in <module>
    import matplotlib
  File "C:\Anaconda3\lib\site-packages\matplotlib\__init__.py", line 1111, in <module>
    rcParamsOrig = RcParams(rcParams.copy())
  File "C:\Anaconda3\lib\site-packages\matplotlib\__init__.py", line 891, in __getitem__
    from matplotlib import pyplot as plt
  File "C:\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 32, in <module>
    import matplotlib.colorbar
  File "C:\Anaconda3\lib\site-packages\matplotlib\colorbar.py", line 40, in <module>
    import matplotlib._constrained_layout as constrained_layout
  File "C:\Anaconda3\lib\site-packages\matplotlib\_constrained_layout.py", line 52, in <module>
    from matplotlib.legend import Legend
  File "C:\Anaconda3\lib\site-packages\matplotlib\legend.py", line 43, in <module>
    from matplotlib.offsetbox import HPacker, VPacker, TextArea, DrawingArea
  File "C:\Anaconda3\lib\site-packages\matplotlib\offsetbox.py", line 33, in <module>
    from matplotlib.image import BboxImage
  File "C:\Anaconda3\lib\site-packages\matplotlib\image.py", line 19, in <module>
    from matplotlib.backend_bases import FigureCanvasBase
  File "C:\Anaconda3\lib\site-packages\matplotlib\backend_bases.py", line 46, in <module>
    from matplotlib import (
ImportError: cannot import name 'get_backend'

0 个答案:

没有答案