我在蟒蛇新鲜,使用python2.7,并得到了在代码中的一些问题,自爆:“模块”对象有没有属性“interpld”
import numpy as np
from scipy import interpolate
import pylab as py
x=np.r_[0:10:11j]
y=np.sin(x)
xnew=np.r_[0:10:100j]
#f=interpolate.interpld(x,y)
py.figure(1)
py.clf()
py.plot(x,y,'ro')
for kind in ['nearest','zero','slinear','quadtatic','cublic']:
f=interpolate.interpld(x,y,kind=kind)
ynew=f(xnew)
py.plot(xnew,ynew,label=kind)
py.legend(loc='lower right')
,但它造成了:
Traceback (most recent call last):
File "C:\Users\LCL\.xy\startups\python_web\my_first_try_on_python_web\python_Interpolation\example1.py", line 22, in <module>
f=interpolate.interpld(x,y,kind=kind)
AttributeError: 'module' object has no attribute 'interpld'
什么'print scipy.interpolate .__ file__'说? – 2013-04-23 16:04:41
它说:C:\ Python27 \ lib \ site-packages \ scipy \ interpolate \ __ init __。pyc – ray 2013-04-23 16:12:39
至少你没有混淆模块。但正如下面的答案指出的那样,你拼错了一些东西。 – 2013-04-23 16:15:49