Traceback AttributeError: el módulo 'pyaudio' no tiene atributo '__version__'

Sep 05 2020

Intallé SppechRecognition y cuando lo hice

import speech_recognition as sr

# obtain audio from the microphone
r = sr.Recognizer()
with sr.Microphone() as source:
    print("Say something!")
    audio = r.listen(source)
try:
    # for testing purposes, we're just using the default API key
    # to use another API key, use `r.recognize_google(audio, key="GOOGLE_SPEECH_RECOGNITION_API_KEY")`
    # instead of `r.recognize_google(audio)`
    print("Google Speech Recognition thinks you said " + r.recognize_google(audio))
except sr.UnknownValueError:
    print("Google Speech Recognition could not understand audio")
except sr.RequestError as e:
    print("Could not request results from Google Speech Recognition service; {0}".format(e))

Ocurrió el problema anterior. Se hizo la misma pregunta aquí, ¡pero la solución no me ayudó! AttributeError: el módulo 'pyaudio' no tiene atributo '__version__' ¡ Por favor ayúdame!

Salida de mi terminal: -

Traceback (most recent call last):

File "c:/Users/samar/OneDrive/Desktop/MAIN/projects/Jarvis/jarvis.py", line 4, in <module>
    with sr.Microphone() as source:

File "C:\Users\samar\AppData\Local\Programs\Python\Python38\lib\site-packages\speech_recognition\__init__.py", line 79, in __init__
    self.pyaudio_module = self.get_pyaudio()

File "C:\Users\samar\AppData\Local\Programs\Python\Python38\lib\site-packages\speech_recognition\__init__.py", line 112, in get_pyaudio
    if LooseVersion(pyaudio.__version__) < LooseVersion("0.2.11"):
AttributeError: module 'pyaudio' has no attribute '__version__'

Respuestas

SamarPratapSingh Sep 11 2020 at 16:40

Cuando instalé el paquete de Paquetes de Python no oficiales y ejecuté el código en la terminal. ¡Funcionó!