我正在Windows 10(conda版本4.3.8)中運作Anaconda安裝
這是我試圖在python指令行中運作的代碼:
import matplotlib.pyplot as plt
x = [1,2,3,4]
y = [5,6,7,8]
plt.figure(1)
plt.plot(x,y)
最後一行引發以下錯誤:
C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\font_manager.py:971: MatplotlibDeprecationWarning: The is_string_like function was deprecated in version 2.1.
if is_string_like(family):
C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\font_manager.py:697: MatplotlibDeprecationWarning: The is_string_like function was deprecated in version 2.1.
if is_string_like(family):
C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\text.py:218: MatplotlibDeprecationWarning: The is_string_like function was deprecated in version 2.1.
elif is_string_like(fontproperties):
Traceback (most recent call last):
File "", line 1, in
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 3307, in plot
ax = gca()
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 950, in gca
return gcf().gca(**kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\figure.py", line 1368, in gca
return self.add_subplot(1, 1, 1, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\figure.py", line 1020, in add_subplot
a = subplot_class_factory(projection_class)(self, *args, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axes\_subplots.py", line 73, in __init__
self._axes_class.__init__(self, fig, self.figbox, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axes\_base.py", line 529, in __init__
self._init_axis()
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axes\_base.py", line 622, in _init_axis
self.xaxis = maxis.XAxis(self)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py", line 676, in __init__
self.cla()
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py", line 760, in cla
self.reset_ticks()
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py", line 771, in reset_ticks
cbook.popall(self.majorTicks)
AttributeError: module 'matplotlib.cbook' has no attribute 'popall'
我在根環境中運作它這也是conda清單輸出的一部分
根目錄中是否存在多個版本的matplotlib導緻此問題?我該如何解決?