【问题标题】:FLAC conversion utility not available - consider installing the FLAC command line application on Spyder/Windows 10FLAC 转换实用程序不可用 - 考虑在 Spyder/Windows 10 上安装 FLAC 命令行应用程序
【发布时间】:2022-01-06 16:08:45
【问题描述】:

我正在使用 Spyder 5.1.5/Anaconda (Python 3.8.10) 在 Windows 10 上按照this PythonCode page 中显示的示例进行语音识别。

我用conda install -c conda-forge 安装了SpeechRecognitionpydub,当我运行以下脚本时:

with sr.AudioFile(filename) as source:
    audio_data = r.record(source)
    text = r.recognize_google(audio_data)
    print(text)

或者更具体地说 (text = r.recognize_google(audio_data)),会显示此错误消息:

OSError: FLAC conversion utility not available - consider installing the FLAC command line application by running `apt-get install flac` or your operating system's equivalent

There's a similar question 但在没有apt-get install flacbrew 的Windows 环境中找不到解决方案。

this post 之后,我已经下载了flac.exe 文件并放在C:\Windows\System32 下。我可以在命令行上运行 flac,但是当我运行 python 脚本时会出现同样的错误。

有人知道如何解决这个问题吗?

【问题讨论】:

    标签: python windows speech-recognition spyder flac


    【解决方案1】:

    根据source code,它正在搜索不带exe 扩展名的flac,该扩展名在Windows 中不起作用。如果失败,它会在模块文件夹中查找具有特定名称 (flac-win32.exe) 的文件。

    您可以尝试删除 System32 文件夹中文件的扩展名或将文件放入模块文件夹中。

    【讨论】:

    • 谢谢!我删除了C:\Windows\System32 中的扩展名(将flac.exe 更改为flac),现在它可以工作了。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-21
    • 1970-01-01
    • 1970-01-01
    • 2017-02-24
    相关资源
    最近更新 更多