0

我正在使用 IPython 和 pandas 来处理 Google Bigquery。我使用“condas install pandas”安装了熊猫。而且我相信 Miniconda 停止了所有依赖项。但是当我尝试在 IPython 笔记本中导入熊猫时,它给了我以下错误:

>         
>     ---------------------------------------------------------------------------
>     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
4

1 回答 1

0

自己找到了解决方案。使用 Miniconda 安装 pandas 时,我们应该确保所有 python 线程都已停止。否则,它会弄乱安装并带来此类错误。

我刚刚停止了所有 python 线程,通过 'conda install -f pandas' 重新安装 pandas,错误消失了

于 2015-03-12T18:00:27.503 回答