简体   繁体   English

Python 无法从某些 scipy.signal 方法导入名称

[英]Python cannot import name from some scipy.signal methods

import numpy as np
from scipy.integrate import odeint
from scipy.signal import find_peaks

The third line triggers the following error:第三行触发以下错误:

ImportError: cannot import name find_peaks

What is going on here?这里发生了什么? I haven't made any changes to the scipy package that I am aware of.我没有对我所知道的 scipy package 进行任何更改。 Also it is worth noting that just importing scipy.signal does not produce an error.另外值得注意的是,仅导入 scipy.signal 不会产生错误。

Check your scipy version:检查您的scipy版本:

import scipy
print(scipy.__version__)

find_peaks is new in version 1.1.0. find_peaks是 1.1.0 版中的新功能。

If you want to update:如果要更新:

pip install scipy --upgrade

I just had to reinstall scipy and it worked on Mac OS with M1 and Python 3.9我只需要重新安装 scipy 它就可以在带有 M1 和 Python 3.9 的 Mac OS 上运行

pip uninstall scipy

and then然后

pip install scipy

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

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