当我写pip时安装pyaudio或-m pip时安装PyAudio 然后,它显示出类似以下的错误-
ERROR: Command errored out with exit status 1:
command: 'C:\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\SUDHAN~1\\AppData\\Local\\Temp\\pip-install-zern0h1s\\PyAudio\\setup.py'"'"'; __file__='"'"'C
:\\Users\\SUDHAN~1\\AppData\\Local\\Temp\\pip-install-zern0h1s\\PyAudio\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();ex
ec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\SUDHAN~1\AppData\Local\Temp\pip-record-b0h1w_j0\install-record.txt' --single-version-externally-managed --compile --install-headers
'C:\python37\Include\PyAudio'
cwd: C:\Users\SUDHAN~1\AppData\Local\Temp\pip-install-zern0h1s\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": http://landinghub.visualstudio.com/visual-cpp-build-tools
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\SUDHAN~1\\AppData\\Local\\Temp\\pip-install-zern0h1s\\PyAudi
o\\setup.py'"'"'; __file__='"'"'C:\\Users\\SUDHAN~1\\AppData\\Local\\Temp\\pip-install-zern0h1s\\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\SUDHAN~1\AppData\Local\Temp\pip-record-b0h1w_j0\install-record.txt' --single-version-externally-ma
naged --compile --install-headers 'C:\python37\Include\PyAudio' Check the logs for full command output.
答案 0 :(得分:0)
需要Microsoft Visual C ++ 14.0。使用“ Microsoft Visual C ++生成工具
您需要安装MS VS here
答案 1 :(得分:0)
如错误所述,安装Microsoft Visual C++ 14.0
-它提供了必需的构建工具。您可以从here下载它。另外,为避免将来出现大多数此类问题,请确保您have Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019-安装所有这些问题。
答案 2 :(得分:0)
下载Visual Studio安装程序。 安装安装程序后,启动它并转到工作负载标签,然后选择C ++构建工具并安装它们。
安装C ++生成工具后,请尝试在新 命令提示符窗口中安装PyAudio。
记住:关闭前一个窗口后,在新的命令提示符窗口中安装PyAudio。
答案 3 :(得分:0)
第1步:从该网站下载Pyaudio
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
取决于您的python版本
步骤2 :然后在下载pyaudio的同一目录中打开cmd
第3步:然后输入以下命令:pip install pyaudiofilename
例如
pip install PyAudio-0.2.11-cp37-cp37m-win_amd64.whl
我希望它能工作!
我也尝试了所有这些答案,但没有一个起作用!
所以我尝试了这种解决方案,并且有效!
这是ScreenShot!
之前
之后