无法导入Pandas:TypeError

时间:2014-10-21 07:38:29

标签: python pandas

我想使用以下pandas,但根本无法导入它。

https://github.com/pydata/pandas/releases/download/v0.15.0/pandas-0.15.0.win-amd64-py2.7.exe

但是我无法导入它:

import pandas as pd

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import pandas as pd
  File "C:\Python27\lib\site-packages\pandas\__init__.py", line 45, in <module>
    from pandas.io.api import *
  File "C:\Python27\lib\site-packages\pandas\io\api.py", line 15, in <module>
    from pandas.io.gbq import read_gbq
  File "C:\Python27\lib\site-packages\pandas\io\gbq.py", line 39, in <module>
    if LooseVersion(_GOOGLE_API_CLIENT_VERSION >= '1.2.0'):
  File "C:\Python27\lib\distutils\version.py", line 265, in __init__
    self.parse(vstring)
  File "C:\Python27\lib\distutils\version.py", line 274, in parse
    self.component_re.split(vstring))
TypeError: expected string or buffer

什么是错误的人?

2 个答案:

答案 0 :(得分:7)

将google-api-python-client升级到高于1.2.0的版本时发生这种情况。 问题在于Pandas,但它已被修复:https://github.com/pydata/pandas/commit/403f38da35ab04d3997f61db3c98134fe02910d3

解决方案是降级google-api-python-client,自行修复pandas中的行或等待pandas 0.15.1

答案 1 :(得分:0)

也许你应该尝试:pip install pandas(顺便说一下,你应该先安装pip)。