Python pyAudio 无法安装:Windows 10
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/53866104/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
pyAudio failed to install : Windows 10
提问by Pankaj Kaundal
When I am trying to install pyAudio
using pip install pyaudio
I get error. It looks like this :
当我试图安装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 Studio17\BuildTools\VC\Tools\MSVC.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 Studio17\BuildTools\VC\Tools\MSVC.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\ucrt" "-
IC:\Program Files (x86)\Windows Kits\include.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\winrt" "-IC:
\Program Files (x86)\Windows Kits\include.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\
Any idea what's going on in here?
知道这里发生了什么吗?
采纳答案by buran
According to official docs of pyaudio:
Microsoft Windows
Install using pip:
python -m pip install pyaudio
Notes: 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. For those versions, both 32-bit and 64-bit wheels are available.
微软Windows
使用pip安装:
python -m pip 安装 pyaudio
注意:pip 将获取并安装 PyAudio 轮子(预打包的二进制文件)。目前,有与 Python 2.7、3.4、3.5和 3.6的官方发行版兼容的轮子。对于这些版本,32 位和 64 位轮都可用。
You try to install pyaudio for 3.7, so it try to compile it. Download and install wheel from Gohlke - Unofficial Windows Binaries for Python Extension Packages. Wheels for 32 and 64-bit python 3.7 are available.
您尝试为 3.7 安装 pyaudio,因此它尝试编译它。从Gohlke下载并安装轮子- 用于 Python 扩展包的非官方 Windows 二进制文件。32 位和 64 位 python 3.7 的轮子可用。
回答by Tomi Aarnio
Try this:
尝试这个:
pip install pipwin
pipwin install pyaudio
pipwin is like pip, but it installs precompiled Windows binaries provided by Christoph Gohlke. Saves you a lot of googling and manual downloading.
pipwin 类似于 pip,但它安装由 Christoph Gohlke 提供的预编译 Windows 二进制文件。为您节省大量的谷歌搜索和手动下载。
回答by Shristi Bisht
Use "https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio" link to download .whl file according to the python version it supports.
使用“ https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio”链接根据其支持的python版本下载.whl文件。
Go to the following directory and run this command on command prompt (Windows here) C:\Users\shris\AppData\Local\Programs\Python\Python37-32\Scripts>pip install PyAudio-0.2.11-cp37-cp37m-win32.whl
转到以下目录并在命令提示符下运行此命令(此处为 Windows) C:\Users\shris\AppData\Local\Programs\Python\Python37-32\Scripts>pip install PyAudio-0.2.11-cp37-cp37m-win32 .whl
回答by Omid Attarnezhad
I had the same issue but it solved by using WHL file which you can download it from https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio.
我遇到了同样的问题,但它通过使用 WHL 文件解决了,您可以从https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio下载它。
There are several versions that you can download and use it like PyAudio-0.2.11-cp37-cp37m-win_amd64.whl.
您可以下载和使用多个版本,例如 PyAudio-0.2.11-cp37-cp37m-win_amd64.whl。
For installing purposes on command prompt write "pip install "path"\PyAudio-0.2.11-cp37-cp37m-win_amd64.whl".
为了在命令提示符下安装,请编写“pip install”path”\PyAudio-0.2.11-cp37-cp37m-win_amd64.whl”。
回答by u2546233
It seems you need to install portaudio first.
看来您需要先安装portaudio。
回答by Patrick Mveng
Here is my computer configuration:
这是我的电脑配置:
- Windows 10
- Python 3.8.0 installed on
C:\Program Files (x86)\Python\Python38-32
- 视窗 10
- Python 3.8.0 安装在
C:\Program Files (x86)\Python\Python38-32
I've got the same issue and i solved it with these steps:
我遇到了同样的问题,我通过以下步骤解决了它:
download PyAudio?0.2.11?cp38?cp38?win32.whlfrom hereon my computer in
C:\Downloads\PyAudio-0.2.11-cp38-cp38-win32.whl
run
C:\Program Files (x86)\Python\Python38-32\Scripts>pip3.8 install C:\Downloads\PyAudio-0.2.11-cp38-cp38-win32.whl --user
从这里在我的电脑上下载PyAudio?0.2.11?cp38?cp38?win32.whl
C:\Downloads\PyAudio-0.2.11-cp38-cp38-win32.whl
跑
C:\Program Files (x86)\Python\Python38-32\Scripts>pip3.8 install C:\Downloads\PyAudio-0.2.11-cp38-cp38-win32.whl --user
回答by rajat prakash
Run CMD as admin then run following two commands this will do the work: 1.pip install pipwin 2.pipwin install pyaudio
以管理员身份运行 CMD 然后运行以下两个命令,这将完成工作: 1.pip install pipwin 2.pipwin install pyaudio