PyAudio 包未安装 [英] PyAudio package not installing

查看:67
本文介绍了PyAudio 包未安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用 pip 安装 PyAudio 包时显示错误,而其他包正在正常安装.我正在使用 python 3.7.为什么会发生此错误?

Trying to install the PyAudio package using pip is showing an error, while other packages are installing normally. I am using python 3.7. Why is this error happening?

C:\Users\Himanshu>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\himanshu\appdata\local\programs\python\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Himanshu\\AppData\\Local\\Temp\\pip-install-romfztqt\\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\Himanshu\AppData\Local\Temp\pip-record-bmeri0ux\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\Community\VC\Tools\MSVC\14.15.26726\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMS_WIN64=1 -Ic:\users\himanshu\appdata\local\programs\python\python37\include -Ic:\users\himanshu\appdata\local\programs\python\python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\cppwinrt" /Tcsrc/_portaudiomodule.c /Fobuild\temp.win-amd64-3.7\Release\src/_portaudiomodule.obj
    _portaudiomodule.c
    c:\users\himanshu\appdata\local\programs\python\python37\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\\Community\\VC\\Tools\\MSVC\\14.15.26726\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

----------------------------------------
Command "c:\users\himanshu\appdata\local\programs\python\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Himanshu\\AppData\\Local\\Temp\\pip-install-romfztqt\\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\Himanshu\AppData\Local\Temp\pip-record-bmeri0ux\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Himanshu\AppData\Local\Temp\pip-install-romfztqt\PyAudio\

推荐答案

当运行 python 3.6 时,这有效,但使用 python 3.7 时它不.

When running python 3.6 this works, but with python 3.7 it doesn't.

PyAudio 最多只支持 python 3.6:

PyAudio only supports up to python 3.6:

pip 将获取并安装 PyAudio 轮子(预打包的二进制文件).目前,有与 Python 2.7、3.4、3.5 和 3.6 的官方发行版兼容的轮子.

pip will fetch and install PyAudio wheels (prepackaged binaries). Currently, there are wheels compatible with the official distributions of Python 2.7, 3.4, 3.5, and 3.6.

解决方法是使用受支持的 Python 版本,或者手动构建和安装 - 如果是后者,您需要确保安装和配置了正确的库.

The workarounds would be to use a supported version of python, or to build and install manually - if the latter, you'll need to make sure you have the correct libraries installed and configured.

我应该指出 PyAudio 似乎已被弃用.自 2017 年 3 月以来,它没有收到更新.因此,我建议您为此找到另一个包.

I should point out that PyAudio appears to be deprecated. It hasn't received an update since March 2017. Therefore I recommend you find another package for this.

这篇关于PyAudio 包未安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆