简体   繁体   中英

Errors on PyAudio on Visual studio code Python

Hello you see I am creating a voice assistant and I have an error on PyAudio I don't know how to fix that I am using The speech recognition module from pip

error:

[Running] python -u "c:\Users\visha\Desktop\Steel\steel.py"
Computer: Good Evening!
Computer: Hello My name is Steel your AI Friendin!
Computer: How may I help you?
Traceback (most recent call last):
  File "C:\Users\visha\AppData\Local\Programs\Python\Python37\lib\site-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 "c:\Users\visha\Desktop\Steel\steel.py", line 63, in <module>
    query = myCommand()
  File "c:\Users\visha\Desktop\Steel\steel.py", line 44, in myCommand
    with sr.Microphone() as source:                                                                       
  File "C:\Users\visha\AppData\Local\Programs\Python\Python37\lib\site-packages\speech_recognition\__init__.py", line 79, in __init__
    self.pyaudio_module = self.get_pyaudio()
  File "C:\Users\visha\AppData\Local\Programs\Python\Python37\lib\site-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

This worked for me:

To install pyaudio on Windows Visual Studio Python

  1. Wheel files are here https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
  2. Download correct wheel file for your version of Python and Windows
  3. In the Visual Studio Packages (PyPl) window, enter the full pathname of your download
  4. Select the Run command pip install line (first one displayed)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM