AttributeError:“模块"对象没有属性“版本" [英] AttributeError: 'module' object has no attribute 'version'
本文介绍了AttributeError:“模块"对象没有属性“版本"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在学习如何使用熊猫,但遇到以下错误:
I am working on learning how to use pandas but get the following error:
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'
我不知道该如何解决.关于如何解决这个问题,您所能说的都是很棒的.
I have no idea how to fix this. Anything you can tell be on how to fix this would be great.
推荐答案
您命名了自己的文件 numpy.py
:
You named a file of your own numpy.py
:
/Users/gregwinter/numpy.py
猜猜哪个Python认为熊猫想要导入? :-)重命名您的程序,并删除周围的所有.pyc或.pyo文件.
Guess which one Python thinks pandas wants to import? :-) Rename your program, and remove any .pyc or .pyo files that are around.
这篇关于AttributeError:“模块"对象没有属性“版本"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文