AttributeError:模块'numpy.core.multiarray'没有属性'einsum'

时间:2017-08-28 06:11:44

标签: python numpy anaconda jupyter-notebook

我使用Anaconda3-4.2.0(Python 3.5.2)并尝试在jupyter笔记本中导入numpy(1.13.1)。 当我尝试时。

import numpy as np

出现以下错误。 如何解决这个错误?

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-115b54337c44> in <module>()
      1 import platform
      2 print(platform.python_version())
----> 3 import numpy as np

/Users/user/.pyenv/versions/anaconda3-4.2.0/lib/python3.5/site-packages/numpy/__init__.py in <module>()
    182         return loader(*packages, **options)
    183 
--> 184     from . import add_newdocs
    185     __all__ = ['add_newdocs',
    186                'ModuleDeprecationWarning',

/Users/user/.pyenv/versions/anaconda3-4.2.0/lib/python3.5/site-packages/numpy/add_newdocs.py in <module>()
     11 from __future__ import division, absolute_import, print_function
     12 
---> 13 from numpy.lib import add_newdoc
     14 
     15 ###############################################################################

/Users/user/.pyenv/versions/anaconda3-4.2.0/lib/python3.5/site-packages/numpy/lib/__init__.py in <module>()
      6 from numpy.version import version as __version__
      7 
----> 8 from .type_check import *
      9 from .index_tricks import *
     10 from .function_base import *

/Users/user/.pyenv/versions/anaconda3-4.2.0/lib/python3.5/site-packages/numpy/lib/type_check.py in <module>()
      9            'common_type']
     10 
---> 11 import numpy.core.numeric as _nx
     12 from numpy.core.numeric import asarray, asanyarray, array, isnan, \
     13                 obj2sctype, zeros

/Users/user/.pyenv/versions/anaconda3-4.2.0/lib/python3.5/site-packages/numpy/core/__init__.py in <module>()
     23 from . import numerictypes as nt
     24 multiarray.set_typeDict(nt.sctypeDict)
---> 25 from . import numeric
     26 from .numeric import *
     27 from . import fromnumeric

/Users/user/.pyenv/versions/anaconda3-4.2.0/lib/python3.5/site-packages/numpy/core/numeric.py in <module>()
    405 compare_chararrays = multiarray.compare_chararrays
    406 putmask = multiarray.putmask
--> 407 einsum = multiarray.einsum
    408 dot = multiarray.dot
    409 inner = multiarray.inner

AttributeError: module 'numpy.core.multiarray' has no attribute 'einsum'

1 个答案:

答案 0 :(得分:1)

更新conda后,此错误不再出现。

谢谢。