I'm trying to install PyAudio for an application to record audio clips from microphone input. I installed PyAudio from executable file (Windows 7, python 2.6). However when I try to import this library in my code, I get the following error.
Please build and install the PortAudio Python bindings first.
I tried the solution provided at Python PyAudio installation problems (with PortAudio) but I got the following error message when I installed it using the executable given at http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
Traceback (most recent call last):
in <module>
import pyaudio
File "C:\Python26\lib\site-packages\pyaudio.py", line 99, in <module>
import _portaudio as pa
ImportError: DLL load failed: %1 is not a valid Win32 application.
I tried building the PortAudio v19 but It also did not work for me. I'm stuck at this point and I'll appreciate any help in this regard.
For this you need to first install brew. Check this link. Then, write in your command
brew install portaudio
Once portaudio is installed, run
pip install python-pyaudio
I tried to install pyaudio into my project in different ways. But it did not work out and I finally found a way to do it. First I went to this link ( https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio ) and downloaded the .whl file related to my Python version.
How to find correct .whl file?
python
in cmd.using above result you can find python version and bit value
using those data download the required .whl file
in above example it was - PyAudio-0.2.11-cp310-cp310-win_amd64.whl
After downloading required .whl file, copy the path of that file
ex - C:\Users\Lahiru\Downloads\PyAudio-0.2.11-cp310-cp310-win_amd64.whl
Then go to the Python project and open the terminal and run following.
pip install C:\Users\Lahiru\Downloads\PyAudio-0.2.11-cp310-cp310-win_amd64.whl
If the installation is successful, Hurray. Now you can use pyaudio.
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.