安装PyoDoad时出错:需要微软Visual C++ 14

2024-09-30 18:30:19 发布

您现在位置:Python中文网/ 问答频道 /正文

在执行pip安装pyaudio后,它开始收集包,但突然显示以下错误

这就是我在终点站遇到的错误

PS C:\Users\user> pip install pyaudio   
Collecting pyaudio
  Using cached PyAudio-0.2.11.tar.gz (37 kB)
Using legacy 'setup.py install' for pyaudio, since package 'wheel' is not installed.
Installing collected packages: pyaudio
    Running setup.py install for pyaudio ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\user\appdata\local\programs\python\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-rqkofe07\\pyaudio_e2694735f99f47ea89c7f6ea2c6b1e31\\setup.py'"'"'; __file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-rqkofe07\\pyaudio_e2694735f99f47ea89c7f6ea2c6b1e31\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\user\AppData\Local\Temp\pip-record-lmei1_wv\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\user\appdata\local\programs\python\python39\Include\pyaudio'
         cwd: C:\Users\user\AppData\Local\Temp\pip-install-rqkofe07\pyaudio_e2694735f99f47ea89c7f6ea2c6b1e31\
    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:\users\user\appdata\local\programs\python\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-rqkofe07\\pyaudio_e2694735f99f47ea89c7f6ea2c6b1e31\\setup.py'"'"'; __file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-rqkofe07\\pyaudio_e2694735f99f47ea89c7f6ea2c6b1e31\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\user\AppData\Local\Temp\pip-record-lmei1_wv\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\user\appdata\local\programs\python\python39\Include\pyaudio' Check the logs for full command output.

Tags: installpippybuildlocalsetuprecordusers
2条回答

虽然@William的解决方案会起作用,但我认为您应该这样做,而不是安装~4 gb的程序

转到here,然后安装合适的车轮 如: 适合我的控制盘是PyAudio-0.2.11-cp39-cp39-win_amd64.whl,因为我有python 3.9(cp39),它是64位安装(amd64)。 在将其安装到目录(比如C:/docs)后,转到cmd并写入

cd C:/docs
pip install PyAudio-0.2.11-cp39-cp39-win_amd64.whl

这应该行得通

extension error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/

错误在回溯中,你需要微软Visual C++。

< >为了在计算机上获得C++,您需要使用错误代码中的链接安装VisualStudio:^ {A1}

相关问题 更多 >