我正在学习如何使用 pandas,但出现以下错误:
Traceback (most recent call last):
File "data_frame.py", line 2, in <module>
import pandas as pd
File "/Users/gregwinter/anaconda2/lib/python2.7/site-packages/pandas/__init__.py", line 13, in <module>
__import__(dependency)
File "/Users/gregwinter/numpy.py", line 22, in <module>
from pandas.compat.numpy_compat import *
File "/Users/gregwinter/anaconda2/lib/python2.7/site-packages/pandas/compat/numpy_compat.py", line 15, in <module>
_np_version = np.version.short_version
AttributeError: 'module' object has no attribute 'version'
我不知道如何解决这个问题。你能告诉我如何解决这个问题的任何事情都会很棒。
最佳答案
你命名了一个自己的文件numpy.py
:
/Users/gregwinter/numpy.py
猜猜 Python 认为 pandas 想要导入哪一个? :-) 重命名您的程序,并删除所有周围的 .pyc 或 .pyo 文件。
关于python-2.7 - 属性错误 : 'module' object has no attribute 'version' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36137200/