安装pyaudio库 出现"portaudio.h":No such file or directory(已解决)

pyaudio出现"portaudio.h":No such file or directory

系统信息
Python version: Python 3.7.2
IDE: PyCharm 2018.3.5 (Community Edition)
JRE: 1.8.0_152-release-1343-b28 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
OS Platform Windows 10 10.0
情况
python -m pip install pyaudio
出错图片信息
安装pyaudio库 出现
分析
直接用pip安装的pyaudio不支持3.7,所以在安装或import的时候会报错
解决方案(介绍一个收集全部python库:lfd.uci)
跳到页面,检索:pyaudio,下载自己系统和python对应的版本whl文件,切换到whl文件目录,直接用pip安装。如下图的第3步说明,便可以解决

出错代码详情

python -m pip  install pyaudio
Collecting pyaudio
Using cached https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196c
e156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz
Installing collected packages: pyaudio
Running setup.py install for pyaudio ... error
Complete output from command c:\users\administrator\appdata\local\programs\p
ython\python38\python.exe -u -c "import setuptools, tokenize;__file__='C:\Users
\ADMINI~1\AppData\Local\Temp\pip-install-8s3mtmuj\pyaudio\setup.py';f=get
attr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.clo
se();exec(compile(code, file, 'exec'))" install --record C:\Users\ADMINI~1\A
ppData\Local\Temp\pip-record-i5bb3diy\install-record.txt --single-version-extern
ally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.8
copying src\pyaudio.py -> build\lib.win-amd64-3.8
running build_ext
building '_portaudio' extension
creating build\temp.win-amd64-3.8
creating build\temp.win-amd64-3.8\Release
creating build\temp.win-amd64-3.8\Release\src
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe
/c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMS_WIN64=1 -Ic:\users\administrator\appdat
a\local\programs\python\python38\include -Ic:\users\administrator\appdata\local\
programs\python\python38\include "-IC:\Program Files (x86)\Microsoft Visual Stud
io 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\AT
LMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucr
t" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Progr
am Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windo
ws Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\win
rt" /Tcsrc/_portaudiomodule.c /Fobuild\temp.win-amd64-3.8\Release\src/_portaudio
module.obj
_portaudiomodule.c
c:\users\administrator\appdata\local\programs\python\python37\include\pyconf
ig.h(117): warning C4005: “MS_WIN64”: 宏重定义
c:\users\administrator\appdata\local\programs\python\python37\include\pyconf
ig.h(117): note: 命令行参数: 参见前面的“MS_WIN64”定义
src/_portaudiomodule.c(29): fatal error C1083: 无法打开包括文件: “portaudio
.h”: No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\B
IN\x86_amd64\cl.exe' failed with exit status 2

----------------------------------------
Command "c:\users\administrator\appdata\local\programs\python\python37\python.ex
e -u -c "import setuptools, tokenize;__file__='C:\Users\ADMINI~1\AppData\Loc
al\Temp\pip-install-8s3mtmuj\pyaudio\setup.py';f=getattr(tokenize, 'open', o
pen)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code,
file, 'exec'))" install --record C:\Users\ADMINI~1\AppData\Local\Temp\pip-re
cord-i5bb3diy\install-record.txt --single-version-externally-managed --compile"
failed with error code 1 in C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-8s3
mtmuj\pyaudio\

你可能感兴趣的:(解决Pyaudio)