【Error】AttributeError: module ‘scipy.misc‘ has no attribute ‘logsumexp‘ 的解决办法

$ python -V
Python 3.7.6

需要用到scipy.misc.logsumexp(),但总是报错

>>> x
array([[ 1., 10.],
       [ 2., 20.],
       [ 3., 30.]])
>>> scipy.misc.logsumexp(x)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'scipy.misc' has no attribute 'logsumexp'

解决办法:将scipy.misc换成scipy.special,就可以了

>>> import scipy.special
>>> scipy.special.logsumexp(x)
30.000045400963103
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页