系统:Windows10
Python ver 3.7
代码
import matplotlib.pyplot as plt
squares = [1, 4, 9, 16, 25]
plt.plot(squares)
plt.show()
报错
解决办法
导致问题的原因是之前练习的时候有个文件命名为numbers.py,与matplotlib的调用文件重名了,导致matplotlib错误调用。将我的numbers.py文件重命名后问题解决。
下面是搜索解决办法时在一个国外论坛上看到的解决办法。
python - matplotlib - AttributeError: module ‘numbers’ has no attribute ‘Integral’ - Stack Overflow https://stackoverflow.com/questions/49535107/matplotlib-attributeerror-module-numbers-has-no-attribute-integral