I have a Windows 10 PC and I want to install pyaudio to use it with my chatbot, powered by chatterbot.
I tried 2 different ways to install pyaudio.
The first way is doing this on the command prompt:
python -m pip install PyAudio
This is the result:
C:\Users\Waaberi>python -m pip install PyAudio
Collecting PyAudio
Using cached https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz
Installing collected packages: PyAudio
Running setup.py install for PyAudio ... error
Complete output from command C:\Users\Waaberi\AppData\Local\Programs\Python\Python37-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Waaberi\\AppData\\Local\\Temp\\pip-install-e5le61j0\\PyAudio\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Waaberi\AppData\Local\Temp\pip-record-adj3zivl\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win32-3.7
copying src\pyaudio.py -> build\lib.win32-3.7
running build_ext
building '_portaudio' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
----------------------------------------
Command "C:\Users\Waaberi\AppData\Local\Programs\Python\Python37-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Waaberi\\AppData\\Local\\Temp\\pip-install-e5le61j0\\PyAudio\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Waaberi\AppData\Local\Temp\pip-record-adj3zivl\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Waaberi\AppData\Local\Temp\pip-install-e5le61j0\PyAudio\
The second way is entering this command:
python pip install python-pyaudio
and it does nothing.
The answer by Agalin is already great and I just want to explain it in a step by step format for a novice like myself:
python --version
mine is 3.7.3
for example.whl
file from here, for example mine is PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl
, and download it.cd C:\Users\foobar\Downloads
.whl
file with pip
for example in my case:pip install PyAudio-0.2.11-cp37-cp37m-win_amd64.whl
First run your IDE or CMD as Administrator and run the following commands:
pip install pipwin
pipwin install pyaudio
There is no wheel (prebuilt package) for Python 3.7 on Windows (there is one for Python 2.7 and 3.4 up to 3.6) so you need to prepare build environment on your PC to use this package. Easier would be finding the wheel for 3.7 as some packages are quite hard to build on Windows.
Christoph Gohlke (University of California) hosts Windows wheels for most popular packages for nearly all modern Python versions, including latest PyAudio. You can find it here: https://www.lfd.uci.edu/~gohlke/pythonlibs/ (download can be quite slow). After download, just type pip install <downloaded file here>
.
There is no difference between python -m pip install
, and pip install
as long as you're using default installation settings and single python installation. python pip
actually tries to run file pip
in the current directory.
Edit. See the pipwin
comment for automated way of using Mr Gohlke's libs . Note that I've not used it myself and I'm not sure about selecting different package flavors like vanilla and mkl versions of numpy
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With