gpt4 book ai didi

python - 在 pyaudio 部分使用语音识别时出错

转载 作者:行者123 更新时间:2023-12-04 09:36:56 28 4
gpt4 key购买 nike

Traceback (most recent call last):
File "C:\Users\Anu Nema\AppData\Local\Programs\Python\Python38-32\lib\site-packages\speech_recognition\__init__.py", line 109, in get_pyaudio
import pyaudio
ModuleNotFoundError: No module named 'pyaudio'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:/Users/Anu Nema/Desktop/New folder/alice/alice.py", line 49, in <module>
takeCommand()
File "c:/Users/Anu Nema/Desktop/New folder/alice/alice.py", line 30, in takeCommand
with sr.Microphone() as source:
File "C:\Users\Anu Nema\AppData\Local\Programs\Python\Python38-32\lib\site-packages\speech_recognition\__init__.py", line 80, in __init__
self.pyaudio_module = self.get_pyaudio()
File "C:\Users\Anu Nema\AppData\Local\Programs\Python\Python38-32\lib\site-packages\speech_recognition\__init__.py", line 111, in get_pyaudio
raise AttributeError("Could not find PyAudio; check installation")
AttributeError: Could not find PyAudio; check installation

最佳答案

发生此错误的原因是您的计算机上没有安装“pyaudio”。这是‘speech_recognition’的依赖项,因此如果你想使用‘speech_recognition’,你必须拥有它。
您可以通过在命令行中键入以下命令来执行此操作:

pip3 install pyaudio
这需要您在计算机上设置 pip。
这应该可以解决您遇到的错误。

关于python - 在 pyaudio 部分使用语音识别时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62529434/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com