【问题标题】:How can I fix the attribute error: module 'noisereduce' has no attribute 'reduce_noise' [duplicate]如何修复属性错误:模块“noisereduce”没有属性“reduce_noise”[重复]
【发布时间】:2020-12-07 11:57:10
【问题描述】:

我已经运行了下面的代码,它一直给我属性错误;

import noisereduce as nr
from scipy.io import wavfile
from noisereduce import reduce_n

# load data
rate, data = wavfile.read("output.wav")
# select section of data that is noise
noisy_part = data[10000:15000]
# perform noise reduction
reduced_noise = nr.reduce_noise(audio_clip=data, noise_clip=noisy_part, verbose=True)

它给出了下面的属性错误

AttributeError: module 'noisereduce' has no attribute 'reduce_noise'

【问题讨论】:

  • 如果您的文件名是“noisereduce.py”,代码将自行导入并引发此问题
  • 哦,非常感谢,已修复
  • 好,请把我的答案添加为有用
  • @eyal 您没有发布答案

标签: python noise-reduction


【解决方案1】:

这是因为我将代码保存为noisereduce.py,当我运行代码时它会自行导入,并且由于没有名为reduce_noise 的命名属性,所以我得到了那个错误。 非常感谢@Eyal

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-14
    • 1970-01-01
    • 1970-01-01
    • 2019-07-11
    • 2020-07-02
    • 2018-07-11
    相关资源
    最近更新 更多