I Am Trying To Install PyAudio Package in Pycharm, but it is not being installed and this error is shown:
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2
Have tried On Pycharm, running on Windows 10
Command Output:
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: started
Running setup.py install for PyAudio: finished with status 'error'
Complete output from command C:\Users\iamsu\PycharmProjects\Casper\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\iamsu\\AppData\\Local\\Temp\\pycharm-packaging\\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\iamsu\AppData\Local\Temp\pip-record-lvejcfmx\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\iamsu\PycharmProjects\Casper\venv\include\site\python3.7\PyAudio:
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
copying src\pyaudio.py -> build\lib.win-amd64-3.7
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
building '_portaudio' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\src
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMS_WIN64=1 -IC:\Users\iamsu\PycharmProjects\Casper\venv\include -IC:\Users\iamsu\AppData\Local\Programs\Python\Python37\include -IC:\Users\iamsu\AppData\Local\Programs\Python\Python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tcsrc/_portaudiomodule.c /Fobuild\temp.win-amd64-3.7\Release\src/_portaudiomodule.obj
_portaudiomodule.c
c:\users\iamsu\appdata\local\programs\python\python37\include\pyconfig.h(117): warning C4005: 'MS_WIN64': macro redefinition
c:\users\iamsu\appdata\local\programs\python\python37\include\pyconfig.h(117): note: command-line arguments: see previous definition of 'MS_WIN64'
src/_portaudiomodule.c(29): fatal error C1083: Cannot open include file: 'portaudio.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2
----------------------------------------
Command "C:\Users\iamsu\PycharmProjects\Casper\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\iamsu\\AppData\\Local\\Temp\\pycharm-packaging\\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\iamsu\AppData\Local\Temp\pip-record-lvejcfmx\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\iamsu\PycharmProjects\Casper\venv\include\site\python3.7\PyAudio" failed with error code 1 in C:\Users\iamsu\AppData\Local\Temp\pycharm-packaging\PyAudio\
I had same issue which was solved by executing below commands.
pip install pipwin
pipwin install pyaudio
You need to install C++ Build Tools to download this package. Alternatively, you can download and install Visual Studio.
The Problem in PyCharm is probably caused because you are not using the right Python Interpreter. Most Users install first Python then PyCharm, without knowing that PyCharm install another Python Installation with it together. This should be the same issue with you because your PyCharm tries to use the build.py in the Visual Studio Directory. So here is what you have to check:
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.