在python库导入期间获取AttributeError

时间:2019-01-18 14:52:12

标签: python pandas pip jupyter-notebook conda

我正在使用pip使用jupyter笔记本,并且所有库都能正常工作。但是从今天起,它突然开始在每个库上显示以下错误。我不知道发生了什么。

在Conda中运行正常。

import pandas as pd

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-7dd3504c366f> in <module>()
----> 1 import pandas as pd

c:\users\aamir siddiqui\appdata\local\programs\python\python36\lib\site-packages\pandas\__init__.py in <module>()
     11 for dependency in hard_dependencies:
     12     try:
---> 13         __import__(dependency)
     14     except ImportError as e:
     15         missing_dependencies.append(dependency)

c:\users\aamir siddiqui\appdata\local\programs\python\python36\lib\site-packages\numpy\__init__.py in <module>()
    140     from . import _distributor_init
    141 
--> 142     from . import core
    143     from .core import *
    144     from . import compat

c:\users\aamir siddiqui\appdata\local\programs\python\python36\lib\site-packages\numpy\core\__init__.py in <module>()
     55 from . import umath
     56 from . import _internal  # for freeze programs
---> 57 from . import numerictypes as nt
     58 multiarray.set_typeDict(nt.sctypeDict)
     59 from . import numeric

c:\users\aamir siddiqui\appdata\local\programs\python\python36\lib\site-packages\numpy\core\numerictypes.py in <module>()
    109 )
    110 
--> 111 from ._type_aliases import (
    112     sctypeDict,
    113     sctypeNA,

c:\users\aamir siddiqui\appdata\local\programs\python\python36\lib\site-packages\numpy\core\_type_aliases.py in <module>()
     61         _concrete_typeinfo[k] = v
     62 
---> 63 _concrete_types = {v.type for k, v in _concrete_typeinfo.items()}
     64 
     65 

c:\users\aamir siddiqui\appdata\local\programs\python\python36\lib\site-packages\numpy\core\_type_aliases.py in <setcomp>(.0)
     61         _concrete_typeinfo[k] = v
     62 
---> 63 _concrete_types = {v.type for k, v in _concrete_typeinfo.items()}
     64 
     65 

AttributeError: 'tuple' object has no attribute 'type'

1 个答案:

答案 0 :(得分:1)

您是否已将tesorflow更新为1.12? 当我将张量流评估为1.12时,我遇到了相同的情况。 所以我pip install tensorflow==1.10.0,它起作用了。