mac 上的 pyaudio 安装(python 3)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33851379/
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 installation on mac (python 3)
提问by JasonShao
I first tried:
我第一次尝试:
pip install pyaudio
but I was told that
但有人告诉我
-bash: pip: command not found
Then I tried:
然后我尝试:
pip3 install pyaudio
then i got:
然后我得到:
src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
#include "portaudio.h"
^
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4 -c "import setuptools, tokenize;__file__='/private/var/folders/77/gz1txkwj2z925vk6jrkx3wp80000gn/T/pip-build-43z_qk7o/pyaudio/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/77/gz1txkwj2z925vk6jrkx3wp80000gn/T/pip-tkf78ih4-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/77/gz1txkwj2z925vk6jrkx3wp80000gn/T/pip-build-43z_qk7o/pyaudio
but I had installed portaudio
但我已经安装了portaudio
brew install portaudio
Warning: portaudio-19.20140130 already installed
警告:portaudio-19.20140130 已经安装
So what can I do. Thanks a lot, it's my first time using pyaudio, so.......
那我能怎么办。非常感谢,这是我第一次使用pyaudio,所以......
:)
:)
采纳答案by JasonShao
I'm assuming you are on a Mac. This is a simple issue to fix.
我假设您使用的是 Mac。这是一个很容易解决的问题。
First install Xcode. Then restart your computer. Afterwards run the commands in sequence,
首先安装Xcode。然后重新启动计算机。然后依次运行命令,
xcode-select --install
brew remove portaudio
brew install portaudio
pip3 install pyaudio
So to clarify, Xcode is installed through the App Store. Xcode command line tools are required for some installations, for others they are not. I'm including it here just to be on the safe side. You also probably do not need to uninstall and reinstall the formula via Homebrew, I did that to ensure that there would be absolutely no problems.
所以澄清一下,Xcode 是通过 App Store 安装的。某些安装需要 Xcode 命令行工具,而其他安装则不需要。我把它包括在这里只是为了安全起见。您也可能不需要通过 Homebrew 卸载和重新安装公式,我这样做是为了确保绝对没有问题。
Edit: I have been told Homebrew requires Xcode. So just run the
编辑:有人告诉我 Homebrew 需要 Xcode。所以只需运行
xcode-select --install
command to be able to use Clang. Also what version of Mac are you on?
命令能够使用 Clang。另外你用的是什么版本的Mac?
回答by Akhils
Steps: I assume you are using a mac osx
步骤:我假设您使用的是 mac osx
download homebrew by pasting this code at any terminal point /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
After installing homebrew, install portaudio: brew install portaudio
Finally install pyaudio using pip pip install pyaudio
通过在任何终端点粘贴此代码来下载自制软件 /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
安装自制软件后,安装portaudio: brew install portaudio
最后使用 pip pip install pyaudio 安装 pyaudio
Note: Ensure you install homebrew if its not already installed
注意:如果尚未安装,请确保安装自制软件
回答by Cindy Y
For a mac, I think you have to type this into Terminal:
对于 mac,我认为你必须在终端中输入:
sudo pip install pyaudio
Also, you might have to install Xcode like said in one of the answers.
此外,您可能必须像其中一个答案中所说的那样安装 Xcode。
回答by Seth-Roosevelt Dabri
Steps: I assume you are using a mac osx
步骤:我假设您正在使用 mac osx
download homebrew
by pasting this code at any terminal point /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
homebrew
通过在任何终端点粘贴此代码来下载/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
After installing homebrew
, install portaudio
: brew install portaudio
安装后homebrew
,安装portaudio
:brew install portaudio
Finally install pyaudio
using pip pip install pyaudio
最后pyaudio
使用 pip pip install 安装pyaudio