Please build and install the PortAudio Python bind

2019-08-20 06:17发布

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

2条回答
We Are One
2楼-- · 2019-08-20 06:24

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

查看更多
聊天终结者
3楼-- · 2019-08-20 06:25

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.

查看更多
登录 后发表回答