AttributeError: type object 'numpy.ndarray' has no attribute '__array_function__'

安装完anaconda遇到如下问题:

dfangwang@dfangwang-B85M-D3V-A:~$ python
Python 2.7.15 |Anaconda, Inc.| (default, Dec 14 2018, 19:04:19) 
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/dfangwang/Documents/yes/lib/python2.7/site-packages/numpy/__init__.py", line 142, in 
    from . import core
  File "/home/dfangwang/Documents/yes/lib/python2.7/site-packages/numpy/core/__init__.py", line 59, in 
    from . import numeric
  File "/home/dfangwang/Documents/yes/lib/python2.7/site-packages/numpy/core/numeric.py", line 3093, in 
    from . import fromnumeric
  File "/home/dfangwang/Documents/yes/lib/python2.7/site-packages/numpy/core/fromnumeric.py", line 17, in 
    from . import _methods
  File "/home/dfangwang/Documents/yes/lib/python2.7/site-packages/numpy/core/_methods.py", line 158, in 
    _NDARRAY_ARRAY_FUNCTION = mu.ndarray.__array_function__
AttributeError: type object 'numpy.ndarray' has no attribute '__array_function__'

解决方案:

AttributeError: type object 'numpy.ndarray' has no attribute '__array_function__'_第1张图片

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple numpy==1.15.4

参考:

http://www.codeleading.com/article/2235321030/;jsessionid=7802F1C6EEA808CB366C649AD1BBDD79

https://github.com/numpy/numpy/issues/12736

下面方案不可行:

AttributeError: type object 'numpy.ndarray' has no attribute '__array_function__'_第2张图片

截图自:https://stackoverflow.com/questions/54176610/attributeerror-type-object-numpy-ndarray-has-no-attribute-array-function

 

你可能感兴趣的:(Python)