问题
i already installed pyaudio but the problem is when i work with the microphone functions
import speech_recognition as sr
r = sr.Recognizer()
mic = sr.Microphone()
the problem is in the third line mic = sr.Microphone()
the terminal will give me this message
Please build and install the PortAudio Python bindings first.
and if i try to install pip install PortAudio
it will give me the following message
Could not find a version that satisfies the requirement PortAudio (from versions: )No matching distribution found for PortAudio
so can any one help , it is like i have the pyaudio but the PortAudio is not there !!
回答1:
Do not type pip install PortAudio
There is no such package
You can rather use
pip install port audio
(lowercase with a space between it).
Happy to Help.
回答2:
first uninstall your pyAudio by pip uninstall pyAudio
then you need to get the pyAudio compatible with your python version in my case i have 3.7 with 32bit , my problem was trying to install a 64bit pyAudio on my 32bit python .
after the uninstalling i went to this website: Unofficial Windows Binaries for Python Extension Packages
and i downloaded the [ PyAudio‑0.2.11‑cp37‑cp37m‑win32.whl ]
the way to install it is to go to its directory in the cmd and type pip install PyAudio‑0.2.11‑cp37‑cp37m‑win32.whl
and i think this will do and over come the PortAudio problem
来源:https://stackoverflow.com/questions/55202342/please-build-and-install-the-portaudio-python-bindings-first