当前位置:  开发笔记 > 编程语言 > 正文

Pandas:AttributeError:'module'对象没有属性'__version__'

如何解决《Pandas:AttributeError:'module'对象没有属性'__version__'》经验,为你挑选了1个好方法。

当我尝试将pandas导入Python时,我收到此错误:

>>> import pandas
Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/robertdefilippi/miniconda2/lib/python2.7/site-packages/pandas/__init__.py", line 44, in 
    from pandas.core.api import *
  File "/Users/robertdefilippi/miniconda2/lib/python2.7/site-packages/pandas/core/api.py", line 9, in 
    from pandas.core.groupby import Grouper
  File "/Users/robertdefilippi/miniconda2/lib/python2.7/site-packages/pandas/core/groupby.py", line 17, in 
    from pandas.core.frame import DataFrame
  File "/Users/robertdefilippi/miniconda2/lib/python2.7/site-packages/pandas/core/frame.py", line 41, in 
    from pandas.core.series import Series
  File "/Users/robertdefilippi/miniconda2/lib/python2.7/site-packages/pandas/core/series.py", line 2909, in 
    import pandas.tools.plotting as _gfx
  File "/Users/robertdefilippi/miniconda2/lib/python2.7/site-packages/pandas/tools/plotting.py", line 135, in 
    if _mpl_ge_1_5_0():
  File "/Users/robertdefilippi/miniconda2/lib/python2.7/site-packages/pandas/tools/plotting.py", line 130, in _mpl_ge_1_5_0
    return (matplotlib.__version__  >= LooseVersion('1.5')
AttributeError: 'module' object has no attribute '__version__'

但是当我检查是否安装了pandas时:

me$ conda install pandas
Fetching package metadata: ....
Solving package specifications: .....................
# All requested packages already installed.
# packages in environment at /Users/me/miniconda2:
#
pandas                    0.17.1              np110py27_0  

所以我不知道出了什么问题?我的熊猫怎么了?

编辑

$ pip list |grep matplotlib
$ conda list matplotlib
# packages in environment at /Users/me/miniconda2:
#
matplotlib                1.5.0               np110py27_0 

出于某种原因,没有输出 pip list |grep matplotlib

EDIT2

我想看看是否有不同的路径的可执行文件ipythonpython.所以我跑了这个:

$ python
>>> import sys
>>> print sys.executable 
/Users/me/miniconda2/bin/python

但是在IPython中,我得到了这个:

$ ipython notebook
>>> import sys
>>> print sys.executable
/usr/local/opt/python/bin/python2.7

这可能是问题吗?



1> Mike Müller..:

matplotlib.py从当前工作目录中删除(或重命名)该文件.它以相同的名称遮蔽真实的库.

推荐阅读
小色米虫_524
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有