Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
343 views
in Technique[技术] by (71.8m points)

python - AttributeError: module 'numbers' has no attribute 'Integral'

Im working on a Mac. Python 3.7.0 is installed. Installed Anaconda, Pandas and Numpy.

In the command line if I type in Python and inside the Python shell I can type in import Pandas and it looks like it worked.

But in Komodo Editor if I execute:

#!/usr/bin/env python3

import pandas

I get the following error:

AttributeError: module 'numbers' has no attribute 'Integral'

EDIT:

Here is the full Code:

#!/usr/bin/env python3

import pandas

def main():
    print('Hello, World.')

if __name__ == '__main__': main()

Here is the Traceback:

Traceback (most recent call last):
  File "/Users/Barry/Documents/Python/testpanda.py", line 3, in <module>
    import pandas
  File "/usr/local/lib/python3.7/site-packages/pandas/__init__.py", line 13, in <module>
    __import__(dependency)
  File "/usr/local/lib/python3.7/site-packages/numpy/__init__.py", line 142, in <module>
    from . import add_newdocs
  File "/usr/local/lib/python3.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/usr/local/lib/python3.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
  File "/usr/local/lib/python3.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/usr/local/lib/python3.7/site-packages/numpy/core/__init__.py", line 35, in <module>
    from . import _internal  # for freeze programs
  File "/usr/local/lib/python3.7/site-packages/numpy/core/_internal.py", line 18, in <module>
    from .numerictypes import object_
  File "/usr/local/lib/python3.7/site-packages/numpy/core/numerictypes.py", line 948, in <module>
    _register_types()
  File "/usr/local/lib/python3.7/site-packages/numpy/core/numerictypes.py", line 943, in _register_types
    numbers.Integral.register(integer)
AttributeError: module 'numbers' has no attribute 'Integral'
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Looking at the github link shared by Du?an Ma?ar, it is most likely that you have a file called 'numbers.py' which might be interfering with the python Lib.

Renaming that file should fix the issue.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...