简体   繁体   English

无法安装 PyAudio,portaudiomodule 错误

[英]Cannot Install PyAudio, portaudiomodule error

Currently trying to install PyAudio on my Surface Pro 7, and am getting this error code when I try to use the prompt pip install PyAudio to install it:目前正在尝试在我的 Surface Pro 7 上安装 PyAudio,当我尝试使用提示pip install PyAudio来安装它时收到此错误代码:

 ERROR: Command errored out with exit status 1:

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\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.28.29333\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2

Can someone help explain why this won't work, please?有人可以帮助解释为什么这不起作用吗? Thanks!谢谢!

Download a wheel file from https://www.lfd.uci.edu/~gohlke/pythonlibs/ and install via pip install wheelfile.whl .https://www.lfd.uci.edu/~gohlke/pythonlibs/下载轮文件并通过pip install wheelfile.whl Check your python version before downloading.下载前检查您的 python 版本。

This issue means that the PyAudio library has a script with an include statement for the portaudio header file.此问题意味着 PyAudio 库有一个包含 portaudio header 文件的包含语句的脚本。 Include statements in C and similar languages are like Import statements in Python. C 和类似语言中的 include 语句类似于 Python 中的 Import 语句。 Because the file doesn't exist, the library can't run.因为文件不存在,所以库无法运行。

If PyAudio is installed via pip, PortAudio has to be downloaded separately.如果通过 pip 安装 PyAudio,则必须单独下载 PortAudio。 Here is the official website with instructions to download.这是带有下载说明的官方网站

An alternative would be to use Anaconda to install packages for python.另一种方法是使用Anaconda安装 python 的软件包。 Anaconda will automatically install portaudio, or provide a reason why it can't, in which case, you will have to follow the steps on the website linked earlier. Anaconda 将自动安装 portaudio,或者提供无法安装的原因,在这种情况下,您必须按照之前链接的网站上的步骤进行操作。

Also, see this SO Question .另外,请参阅此SO Question

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

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