pyAudio安装失败:Windows 10

coo*_*per 2 python pip pyaudio

当我试图安装pyAudio使用pip install pyaudio,我得到的错误。看起来像这样:

C:\Users\pankajkaun>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\pankajkaun\desktop\python\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\PANKAJ~1\\AppData\\Local\\Temp\\pip-install-pw8_ueh5\\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\PANKAJ~1\AppData\Local\Temp
\pip-record-eru_9orv\install-record.txt --single-version-externally-managed --compile:
    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
    creating build\temp.win-amd64-3.7
    creating build\temp.win-amd64-3.7\Release
    creating build\temp.win-amd64-3.7\Release\src
    C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMS_WIN64=1 -Ic:\users\pankajkaun\desktop\python\include -Ic:\users\pankajkaun\desktop\python\
include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-
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\cppwinrt" /Tcsrc/_portaudiomodule.c /Fobuild\temp.win-amd64-3.7\Release\src/_portaudiomodule.obj
    _portaudiomodule.c
    c:\users\pankajkaun\desktop\python\include\pyconfig.h(117): warning C4005: 'MS_WIN64': macro redefinition
    src/_portaudiomodule.c: note: see previous definition of 'MS_WIN64'
    src/_portaudiomodule.c(29): fatal error C1083: Cannot open include file: 'portaudio.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

    ----------------------------------------
Command "c:\users\pankajkaun\desktop\python\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\PANKAJ~1\\AppData\\Local\\Temp\\pip-install-pw8_ueh5\\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\PANKAJ~1\AppData\Local\Temp\pip-record-eru_9orv\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\PANKAJ~1\AppData\Local\Temp\pip-install-pw8_ueh5\pyaudio\
Run Code Online (Sandbox Code Playgroud)

知道这里发生了什么吗?

Tom*_*nio 12

尝试这个:

pip install pipwin
pipwin install pyaudio
Run Code Online (Sandbox Code Playgroud)

pipwin就像pip一样,但是它安装了Christoph Gohlke提供的预编译的Windows二进制文件。为您节省大量的Google搜寻和手动下载。

  • 为了胜利!谢谢! (2认同)
  • 除了“pipwin”不被识别为内部或外部命令之外, (2认同)

bur*_*ran 9

根据pyaudio 的官方文档

微软Windows

使用pip安装:

python -m pip 安装 pyaudio

注意:pip 将获取并安装 PyAudio 轮子(预打包的二进制文件)。目前,有与 Python 2.7、3.4、3.5和 3.6的官方发行版兼容的轮子。对于这些版本,32 位和 64 位轮都可用。

您尝试为 3.7 安装 pyaudio,因此它尝试编译它。从Gohlke下载并安装轮子- 用于 Python 扩展包的非官方 Windows 二进制文件。32 位和 64 位 python 3.7 的轮子可用。


小智 5

使用此链接根据其支持的python版本下载.whl文件: https:
//www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio

然后,转到以下目录并在命令提示符下运行以下命令:

C:\Users\shris\AppData\Local\Programs\Python\Python37-32\Scripts> pip install PyAudio-0.2.11-cp37-cp37m-win32.whl
Run Code Online (Sandbox Code Playgroud)