使用Geany IDE导入matplotlib.pyplot时出错

时间:2017-09-29 22:42:55

标签: python matplotlib

我试图导入matplotlib.pyplot,这是我的代码:

import matplotlib.pyplot as plt

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

我在Ubuntu 16.04.03下使用Geany IDE,我正在使用它 跟随错误消息

[1, 2, 3, 4, 5]
Traceback (most recent call last):
File "mpl_squares.py", line 1, in <module>
import matplotlib.pyplot as plt
File "/usr/local/lib/python3.5/dist-packages/matplotlib/__init__.py", line 122, in <module>
from matplotlib.cbook import is_string_like, mplDeprecation, dedent, get_label
File "/usr/local/lib/python3.5/dist-packages/matplotlib/cbook.py", line 32, in <module>
import numpy as np
File "/usr/local/lib/python3.5/dist-packages/numpy/__init__.py", line 142, in <module>
from . import add_newdocs
File "/usr/local/lib/python3.5/dist-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/usr/local/lib/python3.5/dist-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/usr/local/lib/python3.5/dist-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/usr/local/lib/python3.5/dist-packages/numpy/core/__init__.py", line 35, in <module>
from . import _internal  # for freeze programs
File "/usr/local/lib/python3.5/dist-packages/numpy/core/_internal.py", line 18, in <module>
from .numerictypes import object_
File "/usr/local/lib/python3.5/dist-packages/numpy/core/numerictypes.py", line 962, in <module>
_register_types()
File "/usr/local/lib/python3.5/dist-packages/numpy/core/numerictypes.py", line 958, in _register_types
numbers.Integral.register(integer)
AttributeError: module 'numbers' has no attribute 'Integral'

只有在我使用Geany IDE时才会出现此错误 终端中的代码工作正常。

有人知道Geany有什么问题吗?

提前致谢!

1 个答案:

答案 0 :(得分:0)

使用Geany,您的工作目录是不同的。我认为它与此处相同:

https://www.reddit.com/r/learnpython/comments/5pvdjk/module_object_has_no_attribute_integral/