Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在mac中找不到pyaudio检查安装_Python_Python 3.x_Speech Recognition_Pyaudio - Fatal编程技术网

Python 在mac中找不到pyaudio检查安装

Python 在mac中找不到pyaudio检查安装,python,python-3.x,speech-recognition,pyaudio,Python,Python 3.x,Speech Recognition,Pyaudio,我已经使用brew安装了portaudio,并在macos中使用pip3安装了speechRecognition和pyaudio。 我在运行以下代码时出错 代码: 错误: Traceback (most recent call last): File "test.py", line 8, in <module> with sr.Microphone() as source: File "/Library/Python/2.7/site-

我已经使用brew安装了portaudio,并在macos中使用pip3安装了speechRecognition和pyaudio。 我在运行以下代码时出错

代码:

错误:

     Traceback (most recent call last):
     File "test.py", line 8, in <module>
     with sr.Microphone() as source:
     File "/Library/Python/2.7/site-
     packages/speech_recognition/__init__.py", line 79, in __init__
      self.pyaudio_module = self.get_pyaudio()
     File "/Library/Python/2.7/site-
    packages/speech_recognition/__init__.py", line 110, in get_pyaudio
        raise AttributeError("Could not find PyAudio; check 
    installation")
    AttributeError: Could not find PyAudio; check installation
回溯(最近一次呼叫最后一次):
文件“test.py”,第8行,在
使用sr.麦克风()作为源:
文件“/Library/Python/2.7/site-
packages/speech_recognition/_init__.py”,第79行,in__init__
self.pyaudio_module=self.get_pyaudio()
文件“/Library/Python/2.7/site-
软件包/speech_recognition/_init__uuuuuuuuuuuuuuy.py”,第110行,在get_pyaudio中
raise AttributeError(“找不到PyAudio;请检查
安装“)
AttributeError:找不到PyAudio;检查安装情况
我在nodejs应用程序中使用pythonshell来运行这个python脚本。 当我只使用python3 test.py运行这个脚本时,它工作了,但是使用python test.py时,它不工作了。 在我的节点应用程序中,它也不工作。我认为node正在基本python 2.7版上执行此脚本。 我正在使用MacOs sierra操作系统


请帮助我,提前感谢:-)

您似乎已经为python3安装了软件包,这就是它使用python3的原因,但在从python2.7运行脚本时出现错误,要解决此问题,您必须为python2.7版本安装相同的软件包

您可以运行下面的命令并检查它是否工作

pip2.7安装pyaudio

安装2件东西

brew install portaudio19-dev python-pyaudio
然后呢,

pip install pyaudio

sudo
pip install pyaudio