Traceback AttributeError: module 'pyaudio' has no attribute '__version__'

Traceback AttributeError: module 'pyaudio' has no attribute '__version__'

我安装了 SppechRecognition 并在我写作时

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))

出现了以上问题。 在这里问了同样的问题,但解决方案对我没有帮助! AttributeError: module 'pyaudio' has no attribute '__version__' 请帮助我!

我的终端输出:-

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__'

当我从 Unofficial Python Packages 和 运行 安装程序包时,终端中的代码。成功了!