简体   繁体   English

为什么 scipy.integrate 节目没有“辛普森”属性?

[英]Why scipy.integrate shows has no "simpson" attribute?

I have some python code which uses function scipy.integrate.simpson So for example I import scipy using import scipy.integrate as scp_int and then use it in following way:我有一些使用函数scipy.integrate.simpson的 python 代码例如,我使用import scipy.integrate as scp_int ,然后以下列方式使用它:

vol_r = scp_int.simpson(f_integrand_r,dx=_dx1,axis=0)

I get this error我收到这个错误

    vol_r = scp_int.simpson(f_integrand_r,dx=_dx1,axis=0)
AttributeError: module 'scipy.integrate' has no attribute 'simpson'`

I have made sure that I have scipy package installed, using pip install scipy , and I have restarted computer.我已确保已使用pip install scipy了 scipy 包,并且已重新启动计算机。 I don't know why is this happening?我不知道为什么会这样? Can someone give the reason or help me solve this issue?有人可以给出原因或帮助我解决这个问题吗?

I suspect you are using version 1.5 (or an older version) of SciPy.我怀疑您使用的是 1.5 版(或旧版本)的 SciPy。 If you don't know which version you have installed, you can check with如果您不知道您安装了哪个版本,您可以查看

import scipy
print(scipy.__version__)

simpson was added in 1.6.0; simpson是在 1.6.0 中添加的; it is the new name for the old function called simps .它是名为simps的旧函数的新名称。 If you can't upgrade, you should be able to use simps instead of simpson .如果您无法升级,您应该可以使用simps而不是simpson

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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