简体   繁体   中英

ImportError: cannot import name 'solve_ivp'

I don't understand why I have this error... Here is the code :

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)

I'm using python 3.2.8

It seems that scipy.integrate.solve_ivp() was only introduced in scipy versions > 0.19.1:

Documentation for version 0.19.1 and documentation for version 1.0.0 .

In order to use that function you will have to upgrade your version of scipy

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM