python – 无法导入Pandas:TypeError

我想使用以下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

怎么了?

最佳答案 将google-api-python-client升级到高于1.2.0的版本时,我发生了这种情况.

问题出在Pandas上,但它已修复:
https://github.com/pydata/pandas/commit/403f38da35ab04d3997f61db3c98134fe02910d3

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

点赞