在PyAudio模块中安装时出错

2022-04-11 00:00:00 python python-3.7 python-3.8 pyaudio

问题描述

尝试了无数次后,我仍然无法安装PyAudio而不出现此错误

我已经尝试了许多方法,包括没有被识别为真正函数的PIPWIN,我如何安装PyAudio?

ERROR: Command errored out with exit status 1:
     command: 'C:personpersonAppDataLocalMicrosoftWindowsAppsPythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\person\AppData\Local\Temp\pip-install-csmluknr\pyaudio_4df1e1a74cd34515a3cf4ed28ceefeae\setup.py'"'"'; __file__='"'"'C:\Users\person\AppData\Local\Temp\pip-install-csmluknr\pyaudio_4df1e1a74cd34515a3cf4ed28ceefeae\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'
'"'"', '"'"'
'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UserspersonAppDataLocalTemppip-record-tj523gncinstall-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:UserspersonAppDataLocalPackagesPythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0LocalCachelocal-packagesPython37IncludePyAudio'
         cwd: C:UserspersonAppDataLocalTemppip-install-csmluknrpyaudio_4df1e1a74cd34515a3cf4ed28ceefeae
    Complete output (17 lines):
    running install
    running build
    running build_py
    creating build
    creating buildlib.win-amd64-3.7
    copying srcpyaudio.py -> buildlib.win-amd64-3.7
    running build_ext
    building '_portaudio' extension
    creating build	emp.win-amd64-3.7
    creating build	emp.win-amd64-3.7Release
    creating build	emp.win-amd64-3.7Releasesrc
    C:Program Files (x86)Microsoft Visual Studio2019CommunityVCToolsMSVC14.27.29110inHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMS_WIN64=1 "-IC:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0include" "-IC:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0include" "-IC:Program Files (x86)Microsoft Visual Studio2019CommunityVCToolsMSVC14.27.29110ATLMFCinclude" "-IC:Program Files (x86)Microsoft Visual Studio2019CommunityVCToolsMSVC14.27.29110include" "-IC:Program Files (x86)Windows KitsNETFXSDK4.8includeum" "-IC:Program Files (x86)Windows Kits10include10.0.18362.0ucrt" "-IC:Program Files (x86)Windows Kits10include10.0.18362.0shared" "-IC:Program Files (x86)Windows Kits10include10.0.18362.0um" "-IC:Program Files (x86)Windows Kits10include10.0.18362.0winrt" "-IC:Program Files (x86)Windows Kits10include10.0.18362.0cppwinrt" /Tcsrc/_portaudiomodule.c /Fobuild	emp.win-amd64-3.7Releasesrc/_portaudiomodule.obj
    _portaudiomodule.c
    C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0includepyconfig.h(117): warning C4005: 'MS_WIN64': macro redefinition
    src/_portaudiomodule.c: note: 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\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:UserspersonAppDataLocalMicrosoftWindowsAppsPythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\person\AppData\Local\Temp\pip-install-csmluknr\pyaudio_4df1e1a74cd34515a3cf4ed28ceefeae\setup.py'"'"'; __file__='"'"'C:\Users\person\AppData\Local\Temp\pip-install-csmluknr\pyaudio_4df1e1a74cd34515a3cf4ed28ceefeae\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'
'"'"', '"'"'
'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UserspersonAppDataLocalTemppip-record-tj523gncinstall-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:UserspersonAppDataLocalPackagesPythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0LocalCachelocal-packagesPython37IncludePyAudio' Check the logs for full command output.

解决方案

您可以从here下载PYAudio轮文件。

然后使用pip install XXX.whl安装。

例如:pip install E:/PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl

您可以检查计算机的位数,然后下载相应的轮子。
PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl支持Windows 64位系统的python3.7。 PyAudio‑0.2.11‑cp37‑cp37m‑win32.whl支持适用于Windows 32位系统的python3.7。

相关文章