Kru*_*Raj 7 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\
Run Code Online (Sandbox Code Playgroud)
Jai*_*eer 18
conda install swig
pip install pocketsphinx
Run Code Online (Sandbox Code Playgroud)
我不想做其他人建议的所有设置,所以我尝试了这个并且它起作用了。不过,这可能仅在您使用 Anaconada 时才有效。
Moh*_*awy 11
为了解决这个问题,我下载了swig for windows
将swig.exe复制到python安装文件夹(对于ex C:/ python27)
打开swigwin-3.0.12/Lib文件夹并将所有*.swg文件复制到C:/ python27/lib或等效的python路径
打开swigwin-3.0.12/lib/python并将所有文件复制到(C:/ python27/lib)
(还要确保安装了Microsoft Visual C++ Compiler for Python)
这些步骤对我有用.
您尝试安装pocketsphinx使用pip,这将下载并编译这个模块。它需要一些编译工具,例如swig。
另一个解决方案是安装的二进制版本pocketsphinx。您可以在此处下载二进制版本。您必须根据安装选择正确的版本。
要确定您必须下载哪个版本,可以运行以下命令,这些命令将告诉您所需的版本以及运行32位还是64位python解释器。
"C:\Users\krush\Anaconda3\python.exe" --version
"C:\Users\krush\Anaconda3\python.exe" -c "import struct;print(struct.calcsize('P') * 8)"
Run Code Online (Sandbox Code Playgroud)
下载正确的版本后,您可以输入以下命令
"C:\Users\krush\Anaconda3\python.exe" -m pip install pocketsphinx?0.1.3?cp35?cp35m?win32.whl
"C:\Users\krush\Anaconda3\python.exe" -m pip install pocketsphinx?0.1.3?cp36?cp36m?win_amd64.whl
Run Code Online (Sandbox Code Playgroud)
我也遇到了同样的错误,在 ubuntu 16.04 中安装时,我执行了以下命令:
sudo apt-get install -y python python-dev python-pip build-essential swig git libpulse-dev
sudo pip install pocketsphinx
Run Code Online (Sandbox Code Playgroud)
无需将Swig文件复制到Python文件夹,您只需将Swig的位置添加到环境变量中即可:
Ctrl+Senv并按EnterPathOK并重新启动您的PC