matplotlib调用出错

代码如下:

import matplotlib.pyplot as plt

squares = [1, 4, 9, 16, 25]
plt.plot(squares)
plt.show()

运行结果:

D:\anaconda\python.exe "E:/Python编程从入门到精通配套资料/Self-taught Python/mpl_squares.py"
1
2
3
4
[1, 2, 3, 4, 5]
[2, 4, 6, 8, 10]
Traceback (most recent call last):
  File "E:/Python编程从入门到精通配套资料/Self-taught Python/mpl_squares.py", line 1, in
    import matplotlib.pyplot as plt
  File "D:\anaconda\lib\site-packages\matplotlib\__init__.py", line 122, in
    from matplotlib.cbook import is_string_like, mplDeprecation, dedent, get_label
  File "D:\anaconda\lib\site-packages\matplotlib\cbook.py", line 32, in
    import numpy as np
  File "D:\anaconda\lib\site-packages\numpy\__init__.py", line 142, in
    from . import add_newdocs
  File "D:\anaconda\lib\site-packages\numpy\add_newdocs.py", line 13, in
    from numpy.lib import add_newdoc
  File "D:\anaconda\lib\site-packages\numpy\lib\__init__.py", line 8, in
    from .type_check import *
  File "D:\anaconda\lib\site-packages\numpy\lib\type_check.py", line 11, in
    import numpy.core.numeric as _nx
  File "D:\anaconda\lib\site-packages\numpy\core\__init__.py", line 33, in
    from . import _internal  # for freeze programs
  File "D:\anaconda\lib\site-packages\numpy\core\_internal.py", line 15, in
    from .numerictypes import object_
  File "D:\anaconda\lib\site-packages\numpy\core\numerictypes.py", line 962, in
    _register_types()
  File "D:\anaconda\lib\site-packages\numpy\core\numerictypes.py", line 958, in _register_types
    numbers.Integral.register(integer)
AttributeError: module 'numbers' has no attribute 'Integral'


Process finished with exit code 1

你可能感兴趣的:(matplotlib调用出错)