Hi everyone!
I'm new to python but already have learned about speech recognition. I want to use pyAudio class but the problem is when I'm calling it in a python file the console returns the message " Please build and install the PortAudio Python bindings first. "ow
please help me how to fix this problem . I've searched in sites but didn't find the answer.
thank you.
you should be able to install pyaudio with pip:
pip install pyaudio
# for python 3 may need to use
pip3 install pyaudio
For 3.7 it try to compile,for 3.6 it's get wheel as it should.
For 3.7 use
wheel at Gohlke.
# Check pip,the newest is 18.1(python -m pip install --upgrade pip setuptools wheel)
C:\
λ pip -V
pip 18.1 from c:\python37\lib\site-packages\pip (python 3.7)
# Install the wheel(.whl) file,64-bit Python use amd64.whl
C:\
λ pip install PyAudio-0.2.11-cp37-cp37m-win32.whl
Processing c:\pyaudio-0.2.11-cp37-cp37m-win32.whl
Installing collected packages: PyAudio
Successfully installed PyAudio-0.2.11
If
pip
don't work look at
Python 3.6/3.7 and pip installation under Windows.
thank you for answering
my problem now is not installing pyaudio library it's now "building and installing the PortAudio Python bindings"
(Dec-29-2018, 08:30 PM)nima Wrote: [ -> ]my problem now is not installing pyaudio library it's now "building and installing the PortAudio Python bindings"
The wheel is already build
link.
Quote:pip will fetch and install PyAudio wheels (prepackaged binaries).
These binaries include PortAudio v19 v190600_20161030, built with MinGW. They support only the Windows MME API
So test:
>>> import pyaudio
>>>
>>> pyaudio.__version__
'0.2.11'
Testing there example script:
py_au.py
:
"""PyAudio Example: Play a WAVE file."""
import pyaudio
import wave
import sys
CHUNK = 1024
if len(sys.argv) < 2:
print("Plays a wave file.\n\nUsage: %s filename.wav" % sys.argv[0])
sys.exit(-1)
wf = wave.open(sys.argv[1], 'rb')
p = pyaudio.PyAudio()
stream = p.open(format=p.get_format_from_width(wf.getsampwidth()),
channels=wf.getnchannels(),
rate=wf.getframerate(),
output=True)
data = wf.readframes(CHUNK)
while data != '':
stream.write(data)
data = wf.readframes(CHUNK)
stream.stop_stream()
stream.close()
p.terminate()
It's a command line script so from cmd or
cmder.
E:\div_code\new
λ python py_au.py Alarm.wav