如何解决Python错误“ ModuleNotFoundError:没有名为'pyaudio'的模块?”

问题描述 投票:-2回答:2
File "/usr/local/lib/python3.7/dist-packages/speech_recognition/__init__.py", line 108, 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 "speechrecog.py", line 5, in <module>
    with sr.Microphone() as source:
  File "/usr/local/lib/python3.7/dist-packages/speech_recognition/__init__.py", line 79, in __init__
    self.pyaudio_module = self.get_pyaudio()
  File "/usr/local/lib/python3.7/dist-packages/speech_recognition/__init__.py", line 110, in get_pyaudio
    raise AttributeError("Could not find PyAudio; check installation")
AttributeError: Could not find PyAudio; check installation
python python-3.x
2个回答
0
投票

尝试安装pyaudio(在https://people.csail.mit.edu/hubert/pyaudio/中查看详细信息)。祝你好运


0
投票

这通常在您的程序尝试使用您自己尚未安装的模块时发生。 Python本身内置了一些模块,例如数学。您需要使用pyaudio的方法是将其安装到该项目已经存在的目录中。

© www.soinside.com 2019 - 2024. All rights reserved.