我一直在尝试在Windows计算机上安装用于语音识别的python PocketSphinx模块。为了安装模块,我已经下载了swig(以可执行格式)并将其放在一个目录中,以及修改PATH环境变量以包含该目录。在命令行中测试swig时,它似乎按预期工作。
然后,我尝试使用以下命令从命令行安装PocketSphinx:
python -m pip install pocketsphinx
我收到了以下输出:
Collecting pocketsphinx
Using cached pocketsphinx-0.0.9.tar.gz
Building wheels for collected packages: pocketsphinx
Running setup.py bdist_wheel for pocketsphinx ... error
Complete output from command C:\Users\John\AppData\Local\Programs\Python\Python35\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\John\\AppData\\Local\\Temp\\pip-build-otuma2ab\\pocketsphinx\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d C:\Users\John\AppData\Local\Temp\tmp8ombwfsqpip-wheel- --python-tag cp35:
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.5
creating build\lib.win-amd64-3.5\sphinxbase
copying sphinxbase\swig\python\sphinxbase.py -> build\lib.win-amd64-3.5\sphinxbase
copying sphinxbase\swig\python\__init__.py -> build\lib.win-amd64-3.5\sphinxbase
creating build\lib.win-amd64-3.5\pocketsphinx
copying pocketsphinx\swig\python\pocketsphinx.py -> build\lib.win-amd64-3.5\pocketsphinx
copying pocketsphinx\swig\python\__init__.py -> build\lib.win-amd64-3.5\pocketsphinx
running build_ext
building 'sphinxbase._sphinxbase' extension
swigging sphinxbase/swig/sphinxbase.i to sphinxbase/swig/sphinxbase_wrap.c
C:\Users\John\Documents\swig\swigwin-3.0.8\swigwin-3.0.8\swig.exe -python -modern -Isphinxbase/include -Isphinxbase/include/sphinxbase -Isphinxbase/include/win32 -outdir sphinxbase/swig/python -o sphinxbase/swig/sphinxbase_wrap.c sphinxbase/swig/sphinxbase.i
error: [WinError 2] The system cannot find the file specified
----------------------------------------
Failed building wheel for pocketsphinx
Running setup.py clean for pocketsphinx
Failed to build pocketsphinx
Installing collected packages: pocketsphinx
Running setup.py install for pocketsphinx ... error
Complete output from command C:\Users\John\AppData\Local\Programs\Python\Python35\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\John\\AppData\\Local\\Temp\\pip-build-otuma2ab\\pocketsphinx\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\John\AppData\Local\Temp\pip-nzaehrnb-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.5
creating build\lib.win-amd64-3.5\sphinxbase
copying sphinxbase\swig\python\sphinxbase.py -> build\lib.win-amd64-3.5\sphinxbase
copying sphinxbase\swig\python\__init__.py -> build\lib.win-amd64-3.5\sphinxbase
creating build\lib.win-amd64-3.5\pocketsphinx
copying pocketsphinx\swig\python\pocketsphinx.py -> build\lib.win-amd64-3.5\pocketsphinx
copying pocketsphinx\swig\python\__init__.py -> build\lib.win-amd64-3.5\pocketsphinx
running build_ext
building 'sphinxbase._sphinxbase' extension
swigging sphinxbase/swig/sphinxbase.i to sphinxbase/swig/sphinxbase_wrap.c
C:\Users\John\Documents\swig\swigwin-3.0.8\swigwin-3.0.8\swig.exe -python -modern -Isphinxbase/include -Isphinxbase/include/sphinxbase -Isphinxbase/include/win32 -outdir sphinxbase/swig/python -o sphinxbase/swig/sphinxbase_wrap.c sphinxbase/swig/sphinxbase.i
error: [WinError 2] The system cannot find the file specified
----------------------------------------
Command "C:\Users\John\AppData\Local\Programs\Python\Python35\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\John\\AppData\\Local\\Temp\\pip-build-otuma2ab\\pocketsphinx\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\John\AppData\Local\Temp\pip-nzaehrnb-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\John\AppData\Local\Temp\pip-build-otuma2ab\pocketsphinx\
我试图提取tar.gz文件并自己运行setup.py(解压后):
python setup.py install
具有相同的结果。执行此操作后,我尝试在命令行中执行错误消息上方列出的命令(从目录swig.exe开始)。由于没有输出,我认为它是成功的。这个特定的错误消息似乎只在我运行setup.py文件时出现。我无法弄清楚设置失败的原因。
有人可以告诉我如何解决这个问题吗?
如果似乎无法找到此错误的来源,我将非常感谢安装PocketSphinx模块的另一种方法,这是我的最终目标。