프로그래밍/파이썬

pip install pyaudio 설치에러

do121 2024. 3. 5. 21:44

 

Defaulting to user installation because normal site-packages is not writeable
Collecting pyaudio
  Using cached PyAudio-0.2.14.tar.gz (47 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: pyaudio
  Building wheel for pyaudio (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\program files\python37\python.exe' 'c:\program files\python37\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\nogod\AppData\Local\Temp\tmp7fzj1dg6'
       cwd: C:\Users\nogod\AppData\Local\Temp\pip-install-5w095q4r\pyaudio
  Complete output (11 lines):
  WARNING:root:Warning: VCPKG_PATH envrionment variable not set.
  INFO:root:running bdist_wheel
  INFO:root:running build
  INFO:root:running build_py
  INFO:root:creating build
  INFO:root:creating build\lib.win-amd64-cpython-37
  INFO:root:creating build\lib.win-amd64-cpython-37\pyaudio
  INFO:root:copying src\pyaudio\__init__.py -> build\lib.win-amd64-cpython-37\pyaudio
  INFO:root:running build_ext
  INFO:root:building 'pyaudio._portaudio' extension
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  ----------------------------------------
  ERROR: Failed building wheel for pyaudio
Failed to build pyaudio
ERROR: Could not build wheels for pyaudio which use PEP 517 and cannot be installed directly

위와 같은 에러 발생시 아래와 같이 모두 설치해도 또 에러 발생
 
pip3 install --upgrade pip
 
pip install p5py
 
pip install PEP517
 

C:\Program Files\Python37\Scripts>pip install pyaudio
Defaulting to user installation because normal site-packages is not writeable
Collecting pyaudio
  Downloading PyAudio-0.2.14.tar.gz (47 kB)
     ---------------------------------------- 47.1/47.1 kB 1.2 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pyaudio
  Building wheel for pyaudio (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pyaudio (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [11 lines of output]
      WARNING:root:Warning: VCPKG_PATH envrionment variable not set.
      INFO:root:running bdist_wheel
      INFO:root:running build
      INFO:root:running build_py
      INFO:root:creating build
      INFO:root:creating build\lib.win-amd64-cpython-37
      INFO:root:creating build\lib.win-amd64-cpython-37\pyaudio
      INFO:root:copying src\pyaudio\__init__.py -> build\lib.win-amd64-cpython-37\pyaudio
      INFO:root:running build_ext
      INFO:root:building 'pyaudio._portaudio' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

 
아래에서 Microsoft Visual C++ 14.0 를 받아서 설치한다
https://visualstudio.microsoft.com/ko/visual-cpp-build-tools/

Microsoft C++ Build Tools - Visual Studio

visualstudio.microsoft.com

Defaulting to user installation because normal site-packages is not writeable
Collecting pyaudio
  Using cached PyAudio-0.2.14.tar.gz (47 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pyaudio
  Building wheel for pyaudio (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pyaudio (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [21 lines of output]
      WARNING:root:Warning: VCPKG_PATH envrionment variable not set.
      INFO:root:running bdist_wheel
      INFO:root:running build
      INFO:root:running build_py
      INFO:root:creating build
      INFO:root:creating build\lib.win-amd64-cpython-37
      INFO:root:creating build\lib.win-amd64-cpython-37\pyaudio
      INFO:root:copying src\pyaudio\__init__.py -> build\lib.win-amd64-cpython-37\pyaudio
      INFO:root:running build_ext
      INFO:root:building 'pyaudio._portaudio' extension
      INFO:root:creating build\temp.win-amd64-cpython-37
      INFO:root:creating build\temp.win-amd64-cpython-37\Release
      INFO:root:creating build\temp.win-amd64-cpython-37\Release\src
      INFO:root:creating build\temp.win-amd64-cpython-37\Release\src\pyaudio
      INFO:root:"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DMS_WIN64=1 "-Ic:\program files\python37\include" "-Ic:\program files\python37\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tcsrc/pyaudio/device_api.c /Fobuild\temp.win-amd64-cpython-37\Release\src/pyaudio/device_api.obj /MT
      cl : 명령줄 warning D9025 : '/MD'을(를) '/MT'(으)로 재정의합니다.
      device_api.c
      c:\program files\python37\include\pyconfig.h(117): warning C4005: 'MS_WIN64': 매크로 재정의
      src/pyaudio/device_api.c: note: 'MS_WIN64'의 이전 정의를 참조하십시오.
      src/pyaudio/device_api.c(9): fatal error C1083: 포함 파일을 열 수 없습니다. 'portaudio.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyaudio
Failed to build pyaudio
ERROR: Could not build wheels for pyaudio, which is required to install pyproject.toml-based projects

 
또다시 에러 발생함
구글 검색결과 아래와 같이 pipwin으로 설치하라고함
pip install pipwin
pipwin install pyaudio
 

C:\Users\user\AppData\Roaming\Python\Python37\Scripts>pipwin install pyaudio
Building cache. Hang on . . .
Done
Package `pyaudio` found in cache
Downloading package . . .
https://download.lfd.uci.edu/pythonlibs/archived/cp37/PyAudio-0.2.11-cp37-cp37m-win_amd64.whl
PyAudio-0.2.11-cp37-cp37m-win_amd64.whl
 [*] 111 kB / 111 kB @ 44 kB/s [##################] [100%, 0s left]
Defaulting to user installation because normal site-packages is not writeable
Processing c:\users\user\pipwin\pyaudio-0.2.11-cp37-cp37m-win_amd64.whl
Installing collected packages: PyAudio
Successfully installed PyAudio-0.2.11

 
드디어 설치끝!