pandas v0.17.0: AttributeError: 'unicode' 对象没有属性 'version'

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33159634/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 00:03:17  来源:igfitidea点击:

pandas v0.17.0: AttributeError: 'unicode' object has no attribute 'version'

pythonpandas

提问by user11634

I installed pandas v0.17.0 directly from the sources on my linux suse 13.2 64 bits. I had previously v0.14.1 installed using yast. Now

我直接从我的 linux suse 13.2 64 位上的源安装了 pandas v0.17.0。我之前使用 yast 安装了 v0.14.1。现在

>>> import pandas
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/site-packages/pandas-0.17.0-py2.7-linux-x86_64.egg/pandas/__init__.py", line 44, in <module>
    from pandas.core.api import *
  File "/usr/lib64/python2.7/site-packages/pandas-0.17.0-py2.7-linux-x86_64.egg/pandas/core/api.py", line 9, in <module>
    from pandas.core.groupby import Grouper
  File "/usr/lib64/python2.7/site-packages/pandas-0.17.0-py2.7-linux-x86_64.egg/pandas/core/groupby.py", line 16, in <module>
    from pandas.core.frame import DataFrame
  File "/usr/lib64/python2.7/site-packages/pandas-0.17.0-py2.7-linux-x86_64.egg/pandas/core/frame.py", line 41, in <module>
    from pandas.core.series import Series
  File "/usr/lib64/python2.7/site-packages/pandas-0.17.0-py2.7-linux-x86_64.egg/pandas/core/series.py", line 2864, in <module>
    import pandas.tools.plotting as _gfx
  File "/usr/lib64/python2.7/site-packages/pandas-0.17.0-py2.7-linux-x86_64.egg/pandas/tools/plotting.py", line 135, in <module>
    if _mpl_ge_1_5_0():
  File "/usr/lib64/python2.7/site-packages/pandas-0.17.0-py2.7-linux-x86_64.egg/pandas/tools/plotting.py", line 130, in _mpl_ge_1_5_0
    return (matplotlib.__version__  >= LooseVersion('1.5')
  File "/usr/lib64/python2.7/distutils/version.py", line 296, in __cmp__
    return cmp(self.version, other.version)
AttributeError: 'unicode' object has no attribute 'version'

From some posts, I learned that it might be related to the fact that multiple versions are installed. I des-installed the old pandas version using yast and re-installed the newest one, but the problem persists.

从一些帖子中,我了解到这可能与安装了多个版本的事实有关。我使用 yast 卸载了旧的 pandas 版本并重新安装了最新版本,但问题仍然存在。

回答by The Unfun Cat

pip install -U matplotlib

worked for me.

对我来说有效。

Thanks joris!

谢谢乔里斯!

回答by aloha

I had the same problem and solved it with the command conda update matplotlib.

我遇到了同样的问题并使用命令解决了它conda update matplotlib