python - 安装pocketsphinx python模块: command 'swig.exe' failed

标签 python swig pocketsphinx

我得到了这样的东西。谁能告诉我如何解决这个问题。

C:\Users\krush\Documents\ML using Python>pip install pocketsphinx
Collecting pocketsphinx
  Using cached pocketsphinx-0.1.3.zip
Building wheels for collected packages: pocketsphinx
  Running setup.py bdist_wheel for pocketsphinx: started
  Running setup.py bdist_wheel for pocketsphinx: finished with status 'error'
  Complete output from command C:\Users\krush\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\krush\\AppData\\Local\\Temp\\pip-build-cns2i_wb\\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 C:\Users\krush\AppData\Local\Temp\tmp3tyvnl9wpip-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.exe -python -modern -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/win32 -Ideps/sphinxbase/swig -outdir sphinxbase -o swig/sphinxbase/ad_wrap.c swig/sphinxbase/ad.i
  error: command 'swig.exe' failed: No such file or directory

  ----------------------------------------
  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: started
    Running setup.py install for pocketsphinx: finished with status 'error'
    Complete output from command C:\Users\krush\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\krush\\AppData\\Local\\Temp\\pip-build-cns2i_wb\\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 C:\Users\krush\AppData\Local\Temp\pip-x5mxeczy-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.exe -python -modern -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/win32 -Ideps/sphinxbase/swig -outdir sphinxbase -o swig/sphinxbase/ad_wrap.c swig/sphinxbase/ad.i
    error: command 'swig.exe' failed: No such file or directory

    ----------------------------------------
Command "C:\Users\krush\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\krush\\AppData\\Local\\Temp\\pip-build-cns2i_wb\\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 C:\Users\krush\AppData\Local\Temp\pip-x5mxeczy-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\krush\AppData\Local\Temp\pip-build-cns2i_wb\pocketsphinx\

最佳答案

为了解决这个问题,我下载了swig for windows在撰写此答案时,它是 3.0.12

For the latest swig windows version follow this link

  1. 将 swig.exe 复制到 python 安装文件夹(例如 C:/python27)

  2. 打开swigwin-3.0.12/Lib文件夹并将所有*.swg文件复制到C:/python27/Lib code> 或等效的 python 路径

  3. 打开swigwin-3.0.12/Lib/python并将所有文件复制到C:/python27/Lib

  4. 打开swigwin-3.0.12/Lib文件夹并将typemaps文件夹复制到C:/python27/Lib

(另请确保您安装了适用于 Python 的 Microsoft Visual C++ 编译器)

这些步骤对我有用。

关于python - 安装pocketsphinx python模块: command 'swig.exe' failed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44504899/

相关文章:

python sql查询列表中的时间戳

python - C/C++全局变量在python中是如何实现的?

c++ - swig 和 C++11 兼容性

node.js - pocketsphinx 会刷新标准输出吗?

python - 实时语音识别

Python子进程列表文件不带 "\n"

python - 如何用Python获取最近的工作日?

python - 如何正确地将参数从 Bottle View 传递到装饰 View ?

c - 编译 SWIG 的包装器模块输出时出现 6 个错误?

python - 在 pocketsphinx UI 示例中单击 "Speak"后,进程返回 -11 (0x-b)