freqs = np.linspace(0, sample_rate/2, nfft/2 + 1)
? ?
1、numpy版本问题
2、Python版本问题:在python2,/只留下了整数部分,去掉了小数,是int型。而在python3里,/的结果是真正意义上的除法,结果是float型。所以便出现了Error Message: ‘float‘ object cannot be interpreted as an integer。
? ?
1、numpy 1.18.2 -> numpy 1.17.0
2、修改符号:freqs = np.linspace(0, sample_rate/2, nfft//2 + 1)
? ?
本次采用2解决
【E-10】object of type <class 'float'> cannot be safely interpreted as an integer.(numpy)
原文:https://www.cnblogs.com/yifanrensheng/p/13460540.html