Navigate this page
hide
PyAudio provides Python bindings for PortAudio, the cross-platform audio I/O library. This allows you to use PyAudio to record and play sound on various platforms and operating systems such as Windows, Mac, and Linux. There are two ways to install PyAudio in Visual Studio Code. You can run pip commands in the command line or install the wheel package. This guide will show you both methods.
Installing PyAudio using the pip command
In this method, we run two pip commands in the command line to install PyAudio. Do the following:
- Open the command line in your respective operating system:
–Command Prompt on Windows and Linux
–Terminal on Mac OS. - Run the following two commands:
pip install pipwin
pipwin install pyaudio
- To check if the installation is successful, open the terminal in VS Code.
- Run the following command in the terminal:
pip install PyAudio
- The installation is successful if the output shows “Requirement already satisfied”
Installing PyAudio using wheel
Wheel is a python package or library which contains the PyAudio module. Follow the steps below to install PyAudio using wheel:
- Firstly, check the version of python installed in your system. To do that, run the following command in the command line:
python
- Head over to this website: lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
- Press Ctrl + F to open the search bar and type “PyAudio”. Download the correct version of the Python wheel according to the python version and python architecture highlighted in the above image. Here I will choose 3.10 and 64 bit.
- Right-click on the downloaded file and select the Properties option.
- Select the location and press Ctrl + C to copy.
- Open the command line and type “pip install”. Then, paste the copied path followed by the downloaded file’s name. This is what the command looks like according to my system:
pip install C:UsersgauraDownloadsPyAudio-0.2.11-cp310-cp310-win_amd64.whl
- To check if the installation is successful, open the terminal in VS Code.
- Run the following command in the terminal:
pip install PyAudio
- The installation is successful if the output shows “Requirement already satisfied”