Mail.ruПочтаМой МирОдноклассникиВКонтактеИгрыЗнакомстваНовостиКалендарьОблакоЗаметкиВсе проекты

Выдает ошибку непонятную в Python

Luke Art Ученик (54), на голосовании 1 месяц назад
выводит ошибку помогите пж
 import speech_recognition 

sr = speech_recognition.Recognizer()
sr.pause_threshold = 0.8

def greeting():
return 'здравствуйте сэр'

with speech_recognition.Microphone() as source:
sr.adjust_for_ambient_noise(source=source, duration=0.5)
audio = sr.listen(source=source)
query = sr.recognize_google(audio_data=audio, language='ru-RU').lower()

if query == 'джарвис привет':

print('критические неполадки критические неполадки')

Traceback (most recent call last):
File "C:\Users\timek\Desktop\pythonProject11224\.venv\Lib\site-packages\speech_recognition\", 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 "C:\Users\timek\Desktop\pythonProject11224\", line 11, in
with speech_recognition.Microphone() as source:
File "C:\Users\timek\Desktop\pythonProject11224\.venv\Lib\site-packages\speech_recognition\", line 79, in __init__
self.pyaudio_module = self.get_pyaudio()
File "C:\Users\timek\Desktop\pythonProject11224\.venv\Lib\site-packages\speech_recognition\", line 110, in get_pyaudio
raise AttributeError("Could not find PyAudio; check installation")
AttributeError: Could not find PyAudio; check installation
Голосование за лучший ответ
GGG Просветленный (25575) 2 месяца назад
The error message indicates that the Python module "pyaudio" is missing from your environment. This module is essential for the speech_recognition library to interact with your microphone and process audio input.
Here's how to fix it:
Install PyAudio:
Using pip: Open your terminal or command prompt and run the following command:

 pip install pyaudio 

 conda install -c conda-forge pyaudio 
Verify Installation:
After installation, try running your Python script again. The error should be resolved, and your speech recognition code should work as expected.
Алекс Куха Высший разум (449756) 2 месяца назад
Как удалось установить speech_recognition и не установить pyaudio?
Похожие вопросы