Cannot install pip install pyaudio in Python


  • Whenever I try to install pyaudio in my pycharm or VSCode I get this error -

         command: 'c:\program files\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Rajesh Kumar Chauhan\\AppData\\Local\\Temp\\pip-install-askpa4k
    m\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\Rajesh Kumar Chauhan\\AppData\\Local\\Temp\\pip-install-askpa4km\\pyaudio\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__fi
    le__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Rajesh Kumar Chauhan\AppData\Local\Temp\pip-r
    ecord-ib96rceu\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\Rajesh Kumar Chauhan\AppData\Roaming\Python\Python39\Include\
    pyaudio'
             cwd: C:\Users\Rajesh Kumar Chauhan\AppData\Local\Temp\pip-install-askpa4km\pyaudio\
        Complete output (9 lines):
        running install
        running build
        running build_py
        creating build
        creating build\lib.win-amd64-3.9
        copying src\pyaudio.py -> build\lib.win-amd64-3.9
        running build_ext
        building '_portaudio' extension
        error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
        ----------------------------------------
    ERROR: Command errored out with exit status 1: 'c:\program files\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Rajesh Kumar Chauhan\\AppData\
    \Local\\Temp\\pip-install-askpa4km\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\Rajesh Kumar Chauhan\\AppData\\Local\\Temp\\pip-install-askpa4km\\pyaudio\\setup.py'"'"';f=getattr(tok
    enize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Rajesh Kumar
     Chauhan\AppData\Local\Temp\pip-record-ib96rceu\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\Rajesh Kumar Chauhan\AppData
    \Roaming\Python\Python39\Include\pyaudio' Check the logs for full command output.