Python pip3 pocketsphinx 安装错误

9

在安装Python3中的Pocketsphinx时,我遇到了问题。

我使用的是Anaconda3和Windows10。

pip install --upgrade pocketsphinx

以下是安装Pocketsphinx时出现的错误信息。

Collecting pocketsphinx
     Using cached pocketsphinx-0.1.3.zip
     Building wheels for collected packages: pocketsphinx
     Running setup.py bdist_wheel for pocketsphinx ... error
     Complete output from command /home/geek/anaconda3/bin/python -u -c                                              
     "import setuptools, tokenize;__file__='/tmp/pip-build-k634wg4p  
     /pocketsphinx/setup.py';f=getattr(tokenize, 'open', 
     open)(__file__);code=f.read().replace('\r\n',    
     '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d  
      /tmp/tmp6ts477xjpip-wheel- --python-tag cp36:
     running bdist_wheel
     running build_ext
     building 'sphinxbase._ad' extension
      swigging swig/sphinxbase/ad.i to swig/sphinxbase/ad_wrap.c
   swig -python -modern -Ideps/sphinxbase/include -Ideps/sphinxbase/include  
    /sphinxbase -Ideps/sphinxbase/include/android -Ideps/sphinxbase/swig-   
     outdir sphinxbase -o swig/sphinxbase/ad_wrap.c swig/sphinxbase/ad.i

     unable to execute 'swig': No such file or directory
      error: command 'swig' failed with exit status 1

 ----------------------------------------
 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 /home/geek/anaconda3/bin/python -u -c  
 "import    
 setuptools, tokenize;__file__='/tmp/pip-build-k634wg4p/pocketsphinx  
 /setup.py';f=getattr(tokenize, 'open', 
 open)(__file__);code=f.read().replace('\r\n',  
'\n');f.close();exec(compile(code, __file__, 'exec'))" install --record 
/tmp/pip-q7w8xgtz-record/install-record.txt --single-version-externally-  
managed --compile:
running install
running build_ext
building 'sphinxbase._ad' extension
swigging swig/sphinxbase/ad.i to swig/sphinxbase/ad_wrap.c
swig -python -modern -Ideps/sphinxbase/include -Ideps/sphinxbase/include
/sphinxbase -Ideps/sphinxbase/include/android -Ideps/sphinxbase/swig  
 -outdir sphinxbase -o swig/sphinxbase/ad_wrap.c swig/sphinxbase/ad.i
 unable to execute 'swig': No such file or directory
error: command 'swig' failed with exit status 1

请帮我走出这个困境。


Google Colab用户可能想要查看答案。同时,Windows用户请查看链接以获取安装pocketsphinx的进一步要求。 - Rex5
4个回答

13

尝试使用此命令:

sudo apt-get install swig
它安装了swig,这是pocketsphinx要求之一。

如何撰写答案 添加更多细节来证明你的答案。 - Morse
OP指定他的操作系统是Win 10,apt-get似乎不是一个可行的方法。 - sukhmel

5

如果您使用的是MacOSX操作系统,则可以尝试执行以下指令。

brew install swig

3
你是否已安装Swig?

我遇到了同样的问题,从PyPI的PocketSphinx索引上得知它的要求之一是Swig。可以在http://www.swig.org/download.html(托管在SourceForge上)下载并使用./configure && make && make install组合从源代码安装。
然后,我尝试从源代码安装PocketSphinx,但似乎问题仍然存在,所以你可以尝试继续使用pip。

1

试试这个:

pip install pipwin
pipwin install pocketsphinx

这里似乎是缺少Swig的问题。 - ZF007

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接