如何在 Mac 上安装 Pocketsphinx

问题描述

我正在尝试在 Mac 10.14.6 上安装 pocketsphinx,但收到一条非常长的错误消息。我正在尝试安装这个包,以便能够使用 pypi 包 SpeechRecognition 以便使用 Mac 的麦克风录制转换为适当的文本字符串。

我在 python 3.8.6 中使用的命令是

pip install pocketsphinx

错误消息的最后一小部分在这里

...
...
building 'sphinxbase._ad_openal' extension
    swigging swig/sphinxbase/ad_openal.i to swig/sphinxbase/ad_openal_wrap.c
    swig -python -modern -threads -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/android -Ideps/sphinxbase/swig -outdir sphinxbase -o swig/sphinxbase/ad_openal_wrap.c swig/sphinxbase/ad_openal.i
    Deprecated command line option: -modern. This option is Now always on.
    creating build/temp.macosx-10.14-x86_64-3.8/swig
    creating build/temp.macosx-10.14-x86_64-3.8/swig/sphinxbase
    creating build/temp.macosx-10.14-x86_64-3.8/deps/sphinxbase/src/libsphinxad
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLinetools/SDKs/MacOSX10.14.sdk -I/Library/Developer/CommandLinetools/SDKs/MacOSX10.14.sdk/usr/include -I/Library/Developer/CommandLinetools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DSphinxBASE_EXPORTS -DPOCKETSphinx_EXPORTS -DSphinx_DLL -DHAVE_CONfig_H -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/android -I/System/Library/Frameworks/OpenAL.framework/Versions/A/Headers -I/usr/local/include -I/usr/local/opt/[email protected]/include -I/usr/local/opt/sqlite/include -I/Users/adietz/Private/Coding/Voice/venv/include -I/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c swig/sphinxbase/ad_openal_wrap.c -o build/temp.macosx-10.14-x86_64-3.8/swig/sphinxbase/ad_openal_wrap.o -Wno-macro-redefined -Wno-sign-compare -Wno-logical-op-parentheses
    swig/sphinxbase/ad_openal_wrap.c:1757:7: warning: 'tp_print' is deprecated [-Wdeprecated-declarations]
          0,/* tp_print */
          ^
    /usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/include/python3.8/cpython/object.h:260:5: note: 'tp_print' has been explicitly marked deprecated here
        Py_DEPRECATED(3.8) int (*tp_print)(PyObject *,FILE *,int);
        ^
    /usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/include/python3.8/pyport.h:515:54: note: expanded from macro 'Py_DEPRECATED'
    #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                         ^
    swig/sphinxbase/ad_openal_wrap.c:1924:7: warning: 'tp_print' is deprecated [-Wdeprecated-declarations]
          0,int);
        ^
    /usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/include/python3.8/pyport.h:515:54: note: expanded from macro 'Py_DEPRECATED'
    #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                         ^
    swig/sphinxbase/ad_openal_wrap.c:3878:9: warning: 'tp_print' is deprecated [-Wdeprecated-declarations]
            0,/* tp_print */
            ^
    /usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/include/python3.8/cpython/object.h:260:5: note: 'tp_print' has been explicitly marked deprecated here
        Py_DEPRECATED(3.8) int (*tp_print)(PyObject *,int);
        ^
    /usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/include/python3.8/pyport.h:515:54: note: expanded from macro 'Py_DEPRECATED'
    #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                         ^
    3 warnings generated.
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLinetools/SDKs/MacOSX10.14.sdk -I/Library/Developer/CommandLinetools/SDKs/MacOSX10.14.sdk/usr/include -I/Library/Developer/CommandLinetools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DSphinxBASE_EXPORTS -DPOCKETSphinx_EXPORTS -DSphinx_DLL -DHAVE_CONfig_H -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/android -I/System/Library/Frameworks/OpenAL.framework/Versions/A/Headers -I/usr/local/include -I/usr/local/opt/[email protected]/include -I/usr/local/opt/sqlite/include -I/Users/user/Voice/venv/include -I/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c deps/sphinxbase/src/libsphinxad/ad_openal.c -o build/temp.macosx-10.14-x86_64-3.8/deps/sphinxbase/src/libsphinxad/ad_openal.o -Wno-macro-redefined -Wno-sign-compare -Wno-logical-op-parentheses
    deps/sphinxbase/src/libsphinxad/ad_openal.c:43:10: Fatal error: 'al.h' file not found
    #include <al.h>
             ^~~~~~
    1 error generated.
    error: command 'clang' Failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/user/Voice/venv/bin/python -u -c 'import sys,setuptools,tokenize; sys.argv[0] = '"'"'/private/var/folders/0g/wwq2q6nn35n8vmrwhw5qfk601zlkw_/T/pip-install-6gpn9rjp/pocketsphinx_7af5e010936245adbb59489ab3846a45/setup.py'"'"'; __file__='"'"'/private/var/folders/0g/wwq2q6nn35n8vmrwhw5qfk601zlkw_/T/pip-install-6gpn9rjp/pocketsphinx_7af5e010936245adbb59489ab3846a45/setup.py'"'"';f=getattr(tokenize,'"'"'open'"'"',open)(__file__);code=f.read().replace('"'"'\r\n'"'"','"'"'\n'"'"');f.close();exec(compile(code,__file__,'"'"'exec'"'"'))' install --record /private/var/folders/0g/wwq2q6nn35n8vmrwhw5qfk601zlkw_/T/pip-record-j3hanech/install-record.txt --single-version-externally-managed --compile --install-headers /Users/user/Voice/venv/include/site/python3.8/pocketsphinx Check the logs for full command output.

我错过了什么?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)