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 "<stdin>", line 1, in <module>
  File "/home/dfangwang/Documents/yes/lib/python2.7/site-packages/numpy/__init__.py", line 142, in <module>
    from . import core
  File "/home/dfangwang/Documents/yes/lib/python2.7/site-packages/numpy/core/__init__.py", line 59, in <module>
    from . import numeric
  File "/home/dfangwang/Documents/yes/lib/python2.7/site-packages/numpy/core/numeric.py", line 3093, in <module>
    from . import fromnumeric
  File "/home/dfangwang/Documents/yes/lib/python2.7/site-packages/numpy/core/fromnumeric.py", line 17, in <module>
    from . import _methods
  File "/home/dfangwang/Documents/yes/lib/python2.7/site-packages/numpy/core/_methods.py", line 158, in <module>
    _NDARRAY_ARRAY_FUNCTION = mu.ndarray.__array_function__
AttributeError: type object 'numpy.ndarray' has no attribute '__array_function__'

解决方案:

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

下面方案不可行:

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

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值