我在python3中有这样的脚本(这只是其中的一部分):
import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source:
r.adjust_for_ambient_noise(source)
audio =r.listen(source)
command = r.recognize_sphinx(audio)
它基本上解释了我说的内容并执行简单的命令,但是当我运行它时,它给了我一个巨大的错误:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site- packages/sphinxbase/sphinxbase.py", line 32, in swig_import_helper
return importlib.import_module(mname)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/importli b/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 903, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/si te-packages/sphinxbase/_sphinxbase.so, 2): Symbol not found: _PyClass_Type
Referenced from: /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site- packages/sphinxbase/_sphinxbase.so
Expected in: flat namespace
in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site- packages/sphinxbase/_sphinxbase.so
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site- packages/speech_recognition/__init__.py", line 580, in recognize_sphinx
from sphinxbase import sphinxbase
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site- packages/sphinxbase/sphinxbase.py", line 35, in <module>
_sphinxbase = swig_import_helper()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site- packages/sphinxbase/sphinxbase.py", line 34, in swig_import_helper
return importlib.import_module('_sphinxbase')
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/importli b/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_sphinxbase'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/luistripa/Desktop/Infinity/Confidential/AI.py", line 94, in <module>
Main()
File "/Users/luistripa/Desktop/Infinity/Confidential/AI.py", line 37, in Main
command = r.recognize_sphinx(audio)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site- packages/speech_recognition/__init__.py", line 582, in recognize_sphinx
raise RequestError("missing PocketSphinx module: ensure that PocketSphinx is set up correctly.")
speech_recognition.RequestError: missing PocketSphinx module: ensure that PocketSphinx is set up correctly.
我确信我正确地设置了口袋狮身人面像及其依赖性。 任何人都可以帮助我吗?