我正在尝试使用pip install PyAudio
安装PyAudio,但出现此错误:
(venv) C:\Users\PC\PycharmProjects\untitled>pip 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
Complete output from command C:\Users\PC\PycharmProjects\untitled\venv\Scripts\python.exe -u -c "import setuptools, tokenize;_
_file__='C:\\Users\\PC\\AppData\\Local\\Temp\\pip-install-z9jx52y1\\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\PC\AppData\Local\T
emp\pip-record-dzl_covu\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\PC\PycharmProj
ects\untitled\venv\include\site\python3.7\PyAudio:
running install
running build
running build_py
creating build
creating build\lib.win32-3.7
copying src\pyaudio.py -> build\lib.win32-3.7
running build_ext
building '_portaudio' extension
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
creating build\temp.win32-3.7\Release\src
cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -IC:\Users\PC\PycharmProjects\untitled\venv\include -IC:\Users\PC\AppData\Local\Pro
grams\Python\Python37-32\include -IC:\Users\PC\AppData\Local\Programs\Python\Python37-32\include "-IC:\Program Files (x86)\Windows
Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)
\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Fi
les (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" /Tcsrc/_portaudiomodule.c /Fobuild\temp.win32-3.7\Release\src/_portaudiomodule.o
bj
error: command 'cl.exe' failed: No such file or directory
----------------------------------------
Command "C:\Users\PC\PycharmProjects\untitled\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\PC\\
AppData\\Local\\Temp\\pip-install-z9jx52y1\\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\PC\AppData\Local\Temp\pip-record-dzl_covu\
install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\PC\PycharmProjects\untitled\venv\inclu
de\site\python3.7\PyAudio" failed with error code 1 in C:\Users\PC\AppData\Local\Temp\pip-install-z9jx52y1\PyAudio\
You are using pip version 10.0.1, however version 19.1.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
我也尝试使用pip install PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl
,但是我遇到了同样的问题...
答案 0 :(得分:0)
以管理员身份运行命令提示符,并将 cl.exe 的完整路径添加到 Path 环境变量。