收到“错误:需要 Microsoft Visual C++ 14.0”。安装 PyAudio 时

Gab*_*ino 2 python pip pyaudio

C:\Users\gabri\OneDrive\Desktop>pip3 install pyaudio
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 ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\gabri\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\gabri\\AppData\\Local\\Temp\\pip-install-r9cgblze\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\gabri\\AppData\\Local\\Temp\\pip-install-r9cgblze\\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\gabri\AppData\Local\Temp\pip-record-032v86d_\install-record.txt' --single-version-externally-managed --compile --user --prefix=
         cwd: C:\Users\gabri\AppData\Local\Temp\pip-install-r9cgblze\pyaudio\
    Complete output (9 lines):
    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
    running build_ext
    building '_portaudio' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\gabri\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\gabri\\AppData\\Local\\Temp\\pip-install-r9cgblze\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\gabri\\AppData\\Local\\Temp\\pip-install-r9cgblze\\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\gabri\AppData\Local\Temp\pip-record-032v86d_\install-record.txt' --single-version-externally-managed --compile --user --prefix= Check the logs for full command output.
Run Code Online (Sandbox Code Playgroud)

我的python版本:3.7.4并且pip已升级。

我已经尝试过“python3.7 -m pip install PyAudio”,但它仍然不起作用。

我也尝试过从 .whl 安装它,但是当我运行命令时,会出现以下消息:

错误:PyAudio-0.2.11-cp34-cp34m-win32.whl 在此平台上不受支持。”

我尝试过32位和64位。

小智 9

目前,有与Python 2.7、3.4、3.5和3.6的官方发行版兼容的wheel。

\n\n

显然,该库没有适用于 Python 3.7 的版本,因此我尝试降级 Python 版本。

\n\n

在此站点上下载轮子:https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio

\n\n

选择:

\n\n
    \n
  • PyAudio\xe2\x80\x910.2.11\xe2\x80\x91cp37\xe2\x80\x91cp37m\xe2\x80\x91win32.whl 如果使用 32 位
  • \n
  • PyAudio\xe2\x80\x910.2.11\xe2\x80\x91cp37\xe2\x80\x91cp37m\xe2\x80\x91win_amd64.whl 64 位
  • \n
\n\n

然后转到您的下载文件夹:

\n\n
cd <your_donwload_path>\npip install PyAudio\xe2\x80\x910.2.11\xe2\x80\x91cp37\xe2\x80\x91cp37m\xe2\x80\x91win_amd64.whl\n
Run Code Online (Sandbox Code Playgroud)\n