
python 报错:attributeerror: module 'librosa' has no attribute 'output'
问题描述:
在使用 librosa 库时,运行以下代码时出现错误:
import librosa
y, sr = librosa.load("d:/output/1.wav")
b = librosa.effects.pitch_shift(y, sr, n_steps=-10)
librosa.output.write_wav("gg_pitch_shift.wav",b,sr)报错信息为 "attributeerror: module 'librosa' has no attribute 'output'。"
立即学习“Python免费学习笔记(深入)”;
解决方案:
提示中提到,导致此错误的原因可能是 librosa 库版本问题。建议检查以下情况:
对于旧版本的 librosa,可能需要使用另一种方法来写入 wav 文件,例如:
librosa.core.rir.output_wav("gg_pitch_shift.wav",b,sr)请根据您的 librosa 版本进行相应的调整。
以上就是Python librosa库报错:AttributeError: module 'librosa' has no attribute 'output',如何解决?的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号