在Windows操作系统中安装Pyaudio出现错误

5

我在Windows 10系统中使用Python 2.7。当我尝试从命令提示符安装pyaudio时,使用以下命令:

easy_install pyaudio

我遇到了以下错误提示:

Microsoft Windows [Version 10.0.10240]
(c) 2015 Microsoft Corporation. All rights reserved.

C:\Users\Ankit>easy_install pyaudio
Searching for pyaudio

Reading http://pypi.python.org/simple/pyaudio/
Best match: pyaudio 0.2.8

Downloading http://people.csail.mit.edu/hubert/pyaudio/packages/pyaudio-0.2.8.tar.gz#md5=

Processing pyaudio-0.2.8.tar.gz
Running PyAudio-0.2.8\setup.py -q bdist_egg --dist-dir

 c:\users\ankit\appdata\local\temp\easy_install-ejvxxc\PyAudio-0.2.8\egg-dist-tmp-42gjeh

warning: no files found matching '*.c' under directory 'test'

_portaudiomodule.c
src/_portaudiomodule.c(29) : fatal error C1083: Cannot open include file:

 'portaudio.h': No such file or directory

 error: Setup script exited with error: command '"C:\Program Files(x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe"' failed with exit status 2

我也尝试过

pip install pyaudio

这次收到的错误信息是:

Microsoft Windows [Version 10.0.10240]
(c) 2015 Microsoft Corporation. All rights reserved.

C:\Users\Ankit>pip install pyaudio

You are using pip version 6.0.8, however version 7.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Collecting pyaudio

Could not find any downloads that satisfy the requirement pyaudio
Some externally hosted files were ignored as access to them may be unreliable

 (use --allow-external pyaudio to allow).

No distributions at all found for pyaudio

请帮帮我,非常感谢!!


首先以管理员身份运行您的IDE或CMD,然后运行以下命令:pip install pipwin / pipwin install pyaudio - hassanzadeh.sd
1个回答

2

请看输出:

Some externally hosted files were ignored as access to them may be unreliable    
(use --allow-external pyaudio to allow).

您可以通过向pip添加额外的参数来安装它:

pip install pyaudio --allow-external pyaudio --allow-unverified pyaudio

另外,您是否已安装PortAudio


2
似乎OP在从源代码构建C库方面缺乏经验。在这种情况下,对于OP来说更简单的方法是安装预编译包,例如http://people.csail.mit.edu/hubert/pyaudio/packages/pyaudio-0.2.8.py27.exe。 - Eryk Sun
我遇到了与 OP 相似的问题。我尝试了 user2386841 的解决方案,但它告诉我 no such option --allow-external,也许 pip 已经更新了,我必须尝试其他方法。 - Caleb W.
现在Windows上有几个软件包管理工具。 "Vcpkg"和"winget"都包含Portaudio。 https://winget.run/pkg/intxcc/pyaudio https://vcpkg.info/port/portaudio - caoanan

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接