如何在 Python 3.7 上安装 PyAudio?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/54998028/
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
How do I install PyAudio on Python 3.7?
提问by Cyrielle Albert
I am currently trying to install PyAudio on Python 3.7 but when I use the command "pip install pyaudio", an error message appear:
我目前正在尝试在 Python 3.7 上安装 PyAudio,但是当我使用命令“pip install pyaudio”时,会出现一条错误消息:
"command 'cl.exe' failed: No such file or directory".
“命令‘cl.exe’失败:没有这样的文件或目录”。
I have already tried to modify the PATH but it doesn't worked. I though maybe someone could help me ? Thank you :)
我已经尝试修改 PATH 但它不起作用。我想也许有人可以帮助我?谢谢 :)
回答by Hiadore
Download the wheel on this site https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio.
在此站点上下载轮子https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio。
Choose PyAudio?0.2.11?cp37?cp37m?win32.whl
if you use 32 bit, or PyAudio?0.2.11?cp37?cp37m?win_amd64.whl
for 64 bit.
Then go to your download folder:
选择PyAudio?0.2.11?cp37?cp37m?win32.whl
是使用 32 位还是PyAudio?0.2.11?cp37?cp37m?win_amd64.whl
64 位。然后转到您的下载文件夹:
cd <your_donwload_path>
pip install PyAudio?0.2.11?cp37?cp37m?win_amd64.whl
回答by Joljas k
WINDOWS
视窗
pip install pipwin
pipwin install pyaudio
pip install pipwin
pipwin install pyaudio
This will install pyaudio
这将安装 pyaudio
回答by Influencer_ Subodh Padgilwar
Simply Download wheel file from https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio, get the file for your Python version and bitness. Change the directory location to the download file location or copy downloaded file to the working location.
只需从https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio下载轮文件,获取适用于您的 Python 版本和位数的文件。将目录位置更改为下载文件位置或将下载的文件复制到工作位置。
Install it with pip install filename.whl
使用 pip install filename.whl 安装它
回答by David
It is supported in Python 3.7. Even though not officially on standalone 3.7, Anaconda 2019.10 which uses 3.7 has it. So you have 2 options:
它在 Python 3.7 中受支持。即使没有正式发布在独立 3.7 上,使用 3.7 的 Anaconda 2019.10 也拥有它。所以你有两个选择:
- You can
conda install -c anaconda pyaudio
, if you use Anaconda - Or for standalone Python 3.7 you can:
- 你可以
conda install -c anaconda pyaudio
,如果你使用 Anaconda - 或者对于独立的 Python 3.7,您可以:
2a)After installing the .whl, build portaudio.dll just following the instructions at http://portaudio.com/docs/v19-doxydocs/compile_windows.html. I used VS2019 and i worked. Note if you choose ASIO option you will need ASIO SDK from https://www.steinberg.net/en/company/developers.html
2a)安装 .whl 后,按照http://portaudio.com/docs/v19-doxydocs/compile_windows.html 上的说明构建 portaudio.dll 。我使用了 VS2019 并且我工作了。请注意,如果您选择 ASIO 选项,您将需要来自https://www.steinberg.net/en/company/developers.html 的ASIO SDK
After that just put portaudio.dll anywhere in your system path or local directory and you can import pyaudio
.
之后,只需将 portaudio.dll 放在您的系统路径或本地目录中的任何位置,您就可以import pyaudio
.
2b)If you don't want to build, simply steal portaudio.dll from Anaconda. It's in <Anaconda_root>/Library/bin
2b)如果您不想构建,只需从 Anaconda 窃取 portaudio.dll。在里面<Anaconda_root>/Library/bin
回答by Lifeofkaz
- Install python 3.6
- Install PyCharm
- While in PyCharm click File
- Click on settings
- Click Project Interpreter
- Click on the Gear icon ,You should see Add,Show All Click on Add
- Next Click System Interpreter
- Click the dropdown if you installed python 3.6 you should see it there
- Click it Hit ok and install PyAudio this should fix it..
- 安装 python 3.6
- 安装 PyCharm
- 在 PyCharm 中单击文件
- 点击设置
- 单击项目解释器
- 点击齿轮图标,你应该看到添加,显示全部点击添加
- 下一步单击系统解释器
- 如果您安装了 python 3.6,请单击下拉列表,您应该在那里看到它
- 单击它点击确定并安装 PyAudio 这应该修复它..
回答by A_jain2310
pyaudio is not supported with python 3.7.
python 3.7不支持pyaudio。
Downgrade your version to python 3.6.8.
将您的版本降级到 python 3.6.8。
then try installing pyaudio using the command: pip install pyaudio
然后尝试使用以下命令安装 pyaudio:pip install pyaudio
回答by mollywind
Extract to https://people.csail.mit.edu/hubert/pyaudio/
提取到https://people.csail.mit.edu/hubert/pyaudio/
In Windows:
在Windows 中:
Install using pip:
使用pip安装:
python -m pip install 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的官方发行版兼容的轮子。
Apparently there is no version of that library for Python 3.7, so I'd try downgrading the Python version.
显然,该库没有适用于 Python 3.7 的版本,所以我会尝试降级 Python 版本。
If you continue to have problems with the error of .exe, in this answer https://stackoverflow.com/a/41724634/7290770they solve it.
如果您仍然遇到 .exe 错误的问题,请在此答案https://stackoverflow.com/a/41724634/7290770 中解决它。
回答by Zenshu
It's not compatible with 3.7 and as far as I have been able to find thus far there doesn't appear to be any work being put into making it compatible and I haven't found any sort of replacement, so unless you want to build the package yourself and make it compatible with 3.7 then it can't be used without downgrading your python install to 3.6, I did try Hiadore's answer and that does not work either with 3.7.
它与 3.7 不兼容,据我目前所能找到的,似乎没有任何工作使其兼容,我也没有找到任何替代品,所以除非你想构建自己打包并使其与 3.7 兼容,那么它不能在不将 python 安装降级到 3.6 的情况下使用,我确实尝试了 Hiadore 的答案,但它不适用于 3.7。
回答by Shristi Bisht
Use "https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio" link to download .whl file according to the python version it supports. For Python -3.7 use PyAudio?0.2.11?cp37?cp37m?win32.whl
使用“ https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio”链接根据其支持的python版本下载.whl文件。对于 Python -3.7 使用 PyAudio?0.2.11?cp37?cp37m?win32.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