我无法安装PyAudio

时间:2020-10-24 18:19:22

标签: python pip pyaudio

我尝试了不同的方式来安装 PyAudio ,但是什么都不可能...我每次都看到相同的错误。 我看到其他人也遇到了同样的问题,我读了他的问题,我发现我们的问题都一样。但是有人评论说您可以下载 VsCode C ++构建工具,但是有人可以通过其他方式解决我的问题吗? 如果是,请尽快这样做!

Collecting pyaudio
  Using cached PyAudio-0.2.11.tar.gz (37 kB)
Building wheels for collected packages: pyaudio
  Building wheel for pyaudio (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\som\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Som\\AppData\\Local\\Temp\\pip-install-im6cqmmw\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\Som\\AppData\\Local\\Temp\\pip-install-im6cqmmw\\pyaudio\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\Som\AppData\Local\Temp\pip-wheel-gtvpy8y6'
       cwd: C:\Users\Som\AppData\Local\Temp\pip-install-im6cqmmw\pyaudio\
  Complete output (9 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.8
  copying src\pyaudio.py -> build\lib.win-amd64-3.8
  running build_ext
  building '_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
  Running setup.py clean for pyaudio
Failed to build pyaudio
Installing collected packages: pyaudio
    Running setup.py install for pyaudio ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\som\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Som\\AppData\\Local\\Temp\\pip-install-im6cqmmw\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\Som\\AppData\\Local\\Temp\\pip-install-im6cqmmw\\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\Som\AppData\Local\Temp\pip-record-d6mu781h\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\som\appdata\local\programs\python\python38\Include\pyaudio'
         cwd: C:\Users\Som\AppData\Local\Temp\pip-install-im6cqmmw\pyaudio\
    Complete output (9 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.8
    copying src\pyaudio.py -> build\lib.win-amd64-3.8
    running build_ext
    building '_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: Command errored out with exit status 1: 'c:\users\som\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Som\\AppData\\Local\\Temp\\pip-install-im6cqmmw\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\Som\\AppData\\Local\\Temp\\pip-install-im6cqmmw\\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\Som\AppData\Local\Temp\pip-record-d6mu781h\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\som\appdata\local\programs\python\python38\Include\pyaudio' Check the logs for full command output.

1 个答案:

答案 0 :(得分:0)

如果您正在使用python.org中的标准Python发行版,则可以从Christoph Gohlke的非正式Python Extension Packages for Windows存储库中下载PyAudio滚轮。下载后,在命令提示符或Powershell中,转到下载.whl文件的目录,只需输入

pip install name_of_file_you_just_download.whl

显然是使用文件的真实名称。