简体   繁体   English

无法安装 pyAudio 包

[英]Unable to install pyAudio package

I am building a speech recognition program but can't install pyAudio.我正在构建语音识别程序,但无法安装 pyAudio。

I have installed Microsoft visual c++ 14.0.0 but still, I am getting another error.我已经安装了 Microsoft Visual c++ 14.0.0,但仍然出现另一个错误。 I can't understand what is going wrong here please help me out.我不明白这里出了什么问题,请帮助我。

 ERROR: Command errored out with exit status 1:
         command: 'c:\users\udit\appdata\local\programs\python\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv\[0\] = '"'"'C:\\Users\\udit\\AppData\\Local\\Temp\\pip-install-68co_fpl\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\udit\\AppData\\Local\\Temp\\pip-install-68co_fpl\\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\udit\AppData\Local\Temp\pip-record-ih2tcx4k\install-record.txt' --single-version-externally-managed --compile
             cwd: C:\Users\udit\AppData\Local\Temp\pip-install-68co_fpl\pyaudio\
        Complete output (16 lines):
        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
        b'\\\x00C\x00o\x00m\x00m\x00o\x00n\x00 \x00w\x00a\x00s\x00 \x00u\x00n\x00e\x00x\x00p\x00e\x00c\x00t\x00e\x00d\x00 \x00a\x00t\x00 \x00t\x00h\x00i\x00s\x00 \x00t\x00i\x00m\x00e\x00.\x00\r\x00\n\x00'
        creating build\temp.win32-3.7
        creating build\temp.win32-3.7\Release
        creating build\temp.win32-3.7\Release\src
        C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\Bin\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\udit\appdata\local\programs\python\python37-32\include -Ic:\users\udit\appdata\local\programs\python\python37-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\Include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" /Tcsrc/_portaudiomodule.c /Fobuild\temp.win32-3.7\Release\src/_portaudiomodule.obj
        _portaudiomodule.c
        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 14.0\\VC\\Bin\\cl.exe' failed with exit status 2
        ----------------------------------------
    ERROR: Command errored out with exit status 1: 'c:\users\udit\appdata\local\programs\python\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv\[0\] = '"'"'C:\\Users\\udit\\AppData\\Local\\Temp\\pip-install-68co_fpl\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\udit\\AppData\\Local\\Temp\\pip-install-68co_fpl\\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\udit\AppData\Local\Temp\pip-record-ih2tcx4k\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

These are notes for installation on Microsoft Windows:这些是在 Microsoft Windows 上安装的注意事项:

pip will fetch and install PyAudio wheels (prepackaged binaries). pip 将获取并安装 PyAudio 轮子(预先打包的二进制文件)。 Currently, there are wheels compatible with the official distributions of Python 2.7, 3.4, 3.5, and 3.6.目前,有与 Python 2.7、3.4、3.5 和 3.6 的官方发行版兼容的轮子。 For those versions, both 32-bit and 64-bit wheels are available.对于这些版本,32 位和 64 位轮都可用。

You are using Python 3.7, which is not compatible with PyAudio.您使用的是 Python 3.7,它与 PyAudio 不兼容。 However ...不过……

EDIT :编辑

As user @Dalen states, there are prebuilt binaries ( .exe files) for pyAudio.正如用户@Dalen 所说,pyAudio 有预构建的二进制文件( .exe文件)。 I installed from their archive stated in documentation but importing pyAudio had an output:我从文档中说明的存档中安装,但导入 pyAudio 有一个输出:

视窗蟒蛇

There are unofficial binaries for Windows on this site: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio .此站点上有适用于 Windows 的非官方二进制文件: https : //www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio

Download the proper one and install it .下载合适的并安装它

Download the binary installer for Windows and just install the PyAudio package with no nonsense.下载适用于 Windows 的二进制安装程序,然后安装 PyAudio 包,不要废话。

PyAudio is built on top of portaudio library and you require portaudio to be there. PyAudio 建立在 portaudio 库之上,您需要 portaudio 在那里。 The binary installer comes with precompiled version of portaudio as a dynamically linked library and there is no need for hunting and compiling the source.二进制安装程序带有预编译版本的 portaudio 作为动态链接库,无需搜索和编译源代码。

PyAudio is a great library, enjoy working with it. PyAudio 是一个很棒的库,喜欢使用它。

pip install pipwin

pipwin install pyaudio

Try these commands in prompt.在提示符下尝试这些命令。 It does not require any manual downloads or searches etc. pipwin is a complementary tool for pip on Windows.它不需要任何手动下载或搜索等pipwin是 Windows 上pip的补充工具。 It is capable of installing unofficial python package binaries for Windows provided by Christoph Gohlke它能够安装由 Christoph Gohlke 提供的适用于 Windows 的非官方 python 包二进制文件

the key info in the error message is "Cannot open include file: 'portaudio.h': No such file or directory"错误消息中的关键信息是“无法打开包含文件:'portaudio.h':没有这样的文件或目录”

so you should google it, and you will find it have an answer in stackoverflow: https://stackoverflow.com/a/52191687/5232323所以你应该谷歌一下,你会发现它在stackoverflow中有一个答案: https : //stackoverflow.com/a/52191687/5232323

the current version PyAudio 0.2.11 is not supported for Python 3.7 Python 3.7 不支持当前版本的 PyAudio 0.2.11

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM