命令pip install PyEMD存在问题,不建议使用,若用此命令安装,会报以下错误:
Looking in indexes: http://pypi.doubanio.com/simple/, http://mirrors.aliyun.com/pypi/simple/, https://pypi.tuna.tsinghua.edu.cn/simple/, http://pypi.mirrors.ustc.edu.cn/simple/
Collecting PyEMD
Using cached https://mirrors.bfsu.edu.cn/pypi/web/packages/c0/c5/7fea8e7a71cd026b30ed3c40e4c5ea13a173e28f8855da17e25271e8f545/pyemd-0.5.1.tar.gz (91 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy<2.0.0,>=1.9.0 in e:pythonanaconda3envspython37libsite-packages (from PyEMD) (1.21.2)
Building wheels for collected packages: PyEMD
Building wheel for PyEMD (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'E:pythonAnaconda3envspython37python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\DELL\AppData\Local\Temp\pip-install-n2jen2us\pyemd_cfa6b7dfdd37404b8bbdb61120975e4e\setup.py'"'"'; __file__='"'"'C:\Users\DELL\AppData\Local\Temp\pip-install-n2jen2us\pyemd_cfa6b7dfdd37404b8bbdb61120975e4e\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:UsersDELLAppDataLocalTemppip-wheel-r07120sj'
cwd: C:UsersDELLAppDataLocalTemppip-install-n2jen2uspyemd_cfa6b7dfdd37404b8bbdb61120975e4e
Complete output (11 lines):
running bdist_wheel
running build
running build_py
creating build
creating buildlib.win-amd64-3.7
creating buildlib.win-amd64-3.7pyemd
copying pyemd__about__.py -> buildlib.win-amd64-3.7pyemd
copying pyemd__init__.py -> buildlib.win-amd64-3.7pyemd
running build_ext
building 'pyemd.emd' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
ERROR: Failed building wheel for PyEMD
Running setup.py clean for PyEMD
Failed to build PyEMD
Installing collected packages: PyEMD
Running setup.py install for PyEMD ... error
ERROR: Command errored out with exit status 1:
command: 'E:pythonAnaconda3envspython37python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\DELL\AppData\Local\Temp\pip-install-n2jen2us\pyemd_cfa6b7dfdd37404b8bbdb61120975e4e\setup.py'"'"'; __file__='"'"'C:\Users\DELL\AppData\Local\Temp\pip-install-n2jen2us\pyemd_cfa6b7dfdd37404b8bbdb61120975e4e\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersDELLAppDataLocalTemppip-record-s9ggc882install-record.txt' --single-version-externally-managed --compile --install-headers 'E:pythonAnaconda3envspython37IncludePyEMD'
cwd: C:UsersDELLAppDataLocalTemppip-install-n2jen2uspyemd_cfa6b7dfdd37404b8bbdb61120975e4e
Complete output (13 lines):
running install
E:pythonAnaconda3envspython37libsite-packagessetuptoolscommandinstall.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
setuptools.SetuptoolsDeprecationWarning,
running build
running build_py
creating build
creating buildlib.win-amd64-3.7
creating buildlib.win-amd64-3.7pyemd
copying pyemd__about__.py -> buildlib.win-amd64-3.7pyemd
copying pyemd__init__.py -> buildlib.win-amd64-3.7pyemd
running build_ext
building 'pyemd.emd' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
ERROR: Command errored out with exit status 1: 'E:pythonAnaconda3envspython37python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\DELL\AppData\Local\Temp\pip-install-n2jen2us\pyemd_cfa6b7dfdd37404b8bbdb61120975e4e\setup.py'"'"'; __file__='"'"'C:\Users\DELL\AppData\Local\Temp\pip-install-n2jen2us\pyemd_cfa6b7dfdd37404b8bbdb61120975e4e\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersDELLAppDataLocalTemppip-record-s9ggc882install-record.txt' --single-version-externally-managed --compile --install-headers 'E:pythonAnaconda3envspython37IncludePyEMD' Check the logs for full command output.
可以使用下面命令进行安装:
pip install EMD-signal
如果需要了解更多详细信息,请关注这个链接:PyEMD
1. 简单使用 (1). 导包# 导入工具包 import numpy as np from PyEMD import EEMD, EMD, Visualisation import pylab as plt(2). 定义信号
# Define signal t = np.linspace(0, 1, 200) s = np.cos(11*2*np.pi*t*t) + 6*t*t(3). 对信号进行EMD处理
# Execute EMD on signal IMF = EMD().emd(s,t) N = IMF.shape[0]+1(4). 绘图
# Plot results
plt.subplot(N,1,1)
plt.plot(t, s, 'r')
plt.title("Input signal: $S(t)=cos(22pi t^2) + 6t^2$")
plt.xlabel("Time [s]")
for n, imf in enumerate(IMF):
plt.subplot(N,1,n+2)
plt.plot(t, imf, 'g')
plt.title("IMF "+str(n+1))
plt.xlabel("Time [s]")
plt.tight_layout()
plt.savefig('simple_example')
plt.show()
(5). 结果展示



