I'm trying to install PyAudio for a AI I want to make but I cant. It keeps saying its not found after I have installed it and uninstalled it many times. Last time I ran it this was the error message. I have tried many online forms but none of them helped.
Traceback (most recent call last):
File "C:\Users\fares\AppData\Local\Programs\Python\Python310\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\fares\Documents\Something\AI.py", line 64, in <module>
statement = takeCommand().lower()
File "c:\Users\fares\Documents\Something\AI.py", line 43, in takeCommand
with sr.Microphone() as source:
File "C:\Users\fares\AppData\Local\Programs\Python\Python310\lib\site-packages\speech_recognition\__init__.py", line 79, in __init__
self.pyaudio_module = self.get_pyaudio()
File "C:\Users\fares\AppData\Local\Programs\Python\Python310\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
CodePudding user response:
First of all, please make sure you are not in a virtual environment.
Presuming that you are referring to this PyAudio
, I was able to simply install it using standard pip3 install pyaudio
, and then import pyaudio
worked successfully on Linux.
However, it is possible that you are experiencing platform-specific setup issues on Windows, as pyaudio contains C extensions, so make sure you have PortAudio installed and the environment variable PORTAUDIO_PATH
set. For more information, refer to the project's setup.py
file.
CodePudding user response:
Please make sure pyaudio is installed successfully. You could use pip show pyaudio
in the terminal to query. Pyaudio cannot be simply installed by using pip pyaudio
. You could download .whl file from this.