Problem in python pyAudio

Asked

Viewed 350 times

0

I’m creating a virtual assistant in Python, for the school project, I don’t know much of Python, and always the error in pyAudio, where I’ve searched how to solve and found nothing, the error are these :

  • Modulenotfounderror: No module named 'pyaudio
  • Attributeerror: Could not find Pyaudio; check installation
import speech_recognition as sr #Biblioteca para rec. de voz (transcreve fala em texto)
from chatterbot.trainers import ListTrainer
from chatterbot import ChatBot
import comtypes.client as ct

tts = ct.CreateObject("sapi.SPVoice")
r = sr.Recognizer()

bot = ChatBot('Bot')
dialogo = ['Oi','Olá','olá','oi','tudo bem?','estou bem, e você?','estou bem','que bom'] #Lista de dialogos para treinar o bot
bot.set_trainer(ListTrainer)
bot.train(dialogo)

def main():
  try:
    while True:
      with sr.Microphone() as source:
        r.adjust_for_ambient_noise(source) # Ajustando ruído ambiente
        audio = r.listen(source) # Extrai áudio do microfone
        speech = r.recognize_google(audio, language='pt-BR') #transcrevendo fala em texto com api da Google
        print('Você: ', speech)
        response = bot.get_response(speech)
        print('Bot: ', response)
        resposta = (u""+str(response))
        tts.Speak(resposta)
  except sr.UnknownValueError:
        print('Erro de reconhecimento de fala')

if __name__ == "__main__":
    main()
  • You do not have pyAudio installation where you are running the code, or have installed the package in a different version.

  • and then how do I install? Pip install pyaudio error(remembering that I have Pip)

  • To install follow the Documentation of Pyaudio; The error you have is that pyaudio is not installed

  • Install Pyaudio audio. You can install it using the command: Pip install Pyaudio

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.