首页 > 解决方案 > ImportError:无法导入名称“solve_ivp”

问题描述

我不明白为什么我有这个错误......这是代码:

from scipy.integrate import solve_ivp
def exponential_decay(t, y): return -0.5 * y
sol = solve_ivp(exponential_decay, [0, 10], [2, 4, 8])
print(sol.t)

我正在使用 python 3.2.8

标签: pythonscipy

解决方案


似乎scipy.integrate.solve_ivp()只在scipy> 0.19.1 版本中引入:

版本 0.19.1的文档和版本 1.0.0的文档。

为了使用该功能,您必须升级您的版本scipy


推荐阅读