安装pyaudio时,pip在/usr/local/include中找不到portaudio.h [英] when installing pyaudio, pip cannot find portaudio.h in /usr/local/include

查看:161
本文介绍了安装pyaudio时,pip在/usr/local/include中找不到portaudio.h的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Mac OS X 10.10 正如PyAudio主页所说,我使用以下方式安装PyAudio

I'm using mac osx 10.10 As the PyAudio Homepage said, I install the PyAudio using

brew install portaudio 
pip install pyaudio

portaudio的安装似乎成功,我可以在/usr/local/include和/usr/local/lib中找到标头和库 但是当我尝试安装pyaudio时,它给了我一个错误

the installation of portaudio seems successful, I can find headers and libs in /usr/local/include and /usr/local/lib but when I try to install pyaudio, it gives me an error that

src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
#include "portaudio.h"
         ^
1 error generated.
error: command 'cc' failed with exit status 1

实际上它在/usr/local/include中 为什么找不到文件? 类似问题的某些答案对我不起作用(例如使用virtualenv或手动编译),我想找到一种简单的方法来解决此问题.

actually it is in /usr/local/include why can't it find the file? some answers to similar questions are not working for me(like using virtualenv, or compile it manually), and I want to find a simple way to solve this.

推荐答案

由于pyAudio具有portAudio作为依赖项,因此您首先必须安装portaudio.

Since pyAudio has portAudio as a dependency, you first have to install portaudio.

brew install portaudio

然后尝试:pip install pyAudio.如果在安装portAudio后问题仍然存在,则可以指定编译器将在其中找到源程序的目录路径(例如:portaudio.h).由于标题应位于/usr/local/include目录中:

Then try: pip install pyAudio. If the problem persists after installing portAudio, you can specify the directory path where the compiler will be able to find the source programs (e.g: portaudio.h). Since the headers should be in the /usr/local/include directory:

pip install --global-option='build_ext' --global-option='-I/usr/local/include' --global-option='-L/usr/local/lib' pyaudio

这篇关于安装pyaudio时,pip在/usr/local/include中找不到portaudio.h的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆