我使用IPython和pandas与Google Bigquery合作。我使用' condas install pandas'安装了pandas。我相信Miniconda阻止了所有的依赖。但是当我试图在IPython笔记本中导入pandas时,它给了我以下错误:
>
> ---------------------------------------------------------------------------
> ImportError Traceback (most recent call last)
> <ipython-input-1-a3826df0a77b> in <module>()
> ----> 1 import pandas as pd
> 2
> 3 projectid = "geotab-bigdata-test"
> 4 data_frame = pd.read_gbq('SELECT * FROM RawVin.T20141201', project_id = projectid)
>
> C:\Users\fionazhao\Installed\Continuum\Miniconda\lib\site-packages\pandas\__init__.pyc
> in <module>()
> 45
> 46 # let init-time option registration happen
> ---> 47 import pandas.core.config_init
> 48
> 49 from pandas.core.api import *
>
> C:\Users\fionazhao\Installed\Continuum\Miniconda\lib\site-packages\pandas\core\config_init.py
> in <module>()
> 15 is_instance_factory, is_one_of_factory,
> 16 get_default_val)
> ---> 17 from pandas.core.format import detect_console_encoding
> 18
> 19
>
> C:\Users\fionazhao\Installed\Continuum\Miniconda\lib\site-packages\pandas\core\format.py
> in <module>()
> 7 from pandas.core.base import PandasObject
> 8 from pandas.core.common import adjoin, notnull
> ----> 9 from pandas.core.index import Index, MultiIndex, _ensure_index
> 10 from pandas import compat
> 11 from pandas.compat import(StringIO, lzip, range, map, zip, reduce, u,
>
> C:\Users\fionazhao\Installed\Continuum\Miniconda\lib\site-packages\pandas\core\index.py
> in <module>()
> 13 import pandas.algos as _algos
> 14 import pandas.index as _index
> ---> 15 from pandas.lib import Timestamp, Timedelta, is_datetime_array
> 16 from pandas.core.base import PandasObject, FrozenList, FrozenNDArray, IndexOpsMixin, _shared_docs
> 17 from pandas.util.decorators import (Appender, Substitution, cache_readonly,
>
> ImportError: cannot import name Timedelta
答案 0 :(得分:0)
自己找到解决方案。使用Miniconda安装pandas时,我们应确保所有python线程都已停止。否则,它会搞乱安装并带来这样的错误。
我刚停止所有python线程,通过&conda install -f pandas&#39;重新安装pandas,错误消失了