库 pocketsphinx 不使用 pip 或二进制文件下载

library pocketsphinx not downloading using pip or binary files

我正在开发语音识别软件,想测试 pocketsphinx 并尝试在 windows 10 python 3.8 版上使用 pip 安装它,但它通常不会下载,我会修复将其下载为二进制文件然后尝试安装时出现问题,但它告诉我 whl 文件不受支持,在此先感谢大家。

下面是我收到的错误信息。

ERROR: Command errored out with exit status 1:
command: 'C:\Users\yeetgod\AppData\Local\Programs\Python\Python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\yeetgod\AppData\Local\Temp\pip-install-aims1y79\pocketsphinx\setup.py'"'"'; __file__='"'"'C:\Users\yeetgod\AppData\Local\Temp\pip-install-aims1y79\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\yeetgod\AppData\Local\Temp\pip-record-fcvz7sp8\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\yeetgod\AppData\Local\Temp\pip-install-aims1y79\pocketsphinx\
    Complete output (6 lines):
    running install
    running build_ext
    building 'sphinxbase._sphinxbase' extension
    swigging deps/sphinxbase/swig/sphinxbase.i to deps/sphinxbase/swig/sphinxbase_wrap.c
    swig.exe -python -modern -threads -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/win32 -Ideps/sphinxbase/swig -outdir sphinxbase -o deps/sphinxbase/swig/sphinxbase_wrap.c deps/sphinxbase/swig/sphinxbase.i
    error: command 'swig.exe' failed: No such file or directory
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\yeetgod\AppData\Local\Programs\Python\Python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\yeetgod\AppData\Local\Temp\pip-install-aims1y79\pocketsphinx\setup.py'"'"'; __file__='"'"'C:\Users\yeetgod\AppData\Local\Temp\pip-install-aims1y79\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\yeetgod\AppData\Local\Temp\pip-record-fcvz7sp8\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

我希望二进制文件能正常工作,但给了我这条错误消息

ERROR: pocketsphinx-0.1.15-cp36-cp36m-win32.whl is not a supported wheel on this platform.

然后我尝试了另一个二进制文件(win64 amd 文件),它给了我这个错误:

ERROR: pocketsphinx-0.1.15-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform.

ERROR: pocketsphinx-0.1.15-cp36-cp36m-win32.whl is not a supported wheel on this platform

您正在尝试为 Python 3.6 至 Python 3.8 安装轮子。那是行不通的。

The latest release of pocketsphinx 于 2018 年 6 月 4 日发布,距今已有一年多了。 Python 3.8 当时还不存在,所以他们不提供轮子。

实际上他们甚至没有 Python 3.7 的轮子。您必须使用 Python 3.6 或从源代码编译项目。要从源代码编译,您需要 a number of prerequisites.

错误

error: command 'swig.exe' failed: No such file or directory

表示您缺少先决条件之一 — SWIG。

1。摘要

单独安装 SWIG 到您的机器。


2。免责声明

此答案与 2020 年 4 月相关。未来,其数据可能会过时。

此解决方案可能不适用于不同的环境。


3。独家新闻

Scoop — the simple way to install SWIG Windows 个用户。

scoop install swig

4。行为

4.1。之前

D:\SashaDebugging\KiraMicrophone>pip install pocketsphinx
Collecting pocketsphinx
  Using cached pocketsphinx-0.1.15.tar.gz (29.1 MB)
Installing collected packages: pocketsphinx
    Running setup.py install for pocketsphinx … error
    ERROR: Command errored out with exit status 1:
     command: 'c:\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\SashaChernykh\AppData\Local\Temp\pip-install-n5cb82uz\pocketsphinx\setup.py'"'"'; __file__='"'"'C:\Users\SashaChernykh\AppData\Local\Temp\pip-install-n5cb82uz\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\SashaChernykh\AppData\Local\Temp\pip-record-dq_syyxw\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python38\Include\pocketsphinx'
         cwd: C:\Users\SashaChernykh\AppData\Local\Temp\pip-install-n5cb82uz\pocketsphinx\
    Complete output (6 lines):
    running install
    running build_ext
    building 'sphinxbase._sphinxbase' extension
    swigging deps/sphinxbase/swig/sphinxbase.i to deps/sphinxbase/swig/sphinxbase_wrap.c
    swig.exe -python -modern -threads -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/win32 -Ideps/sphinxbase/swig -outdir sphinxbase -o deps/sphinxbase/swig/sphinxbase_wrap.c deps/sphinxbase/swig/sphinxbase.i
    error: command 'swig.exe' failed: No such file or directory
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\SashaChernykh\AppData\Local\Temp\pip-install-n5cb82uz\pocketsphinx\setup.py'"'"'; __file__='"'"'C:\Users\SashaChernykh\AppData\Local\Temp\pip-install-n5cb82uz\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\SashaChernykh\AppData\Local\Temp\pip-record-dq_syyxw\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python38\Include\pocketsphinx' Check the logs for full command output.

4.2。之后

D:\SashaDebugging\KiraMicrophone>pip install pocketsphinx
Collecting pocketsphinx
  Using cached pocketsphinx-0.1.15.tar.gz (29.1 MB)
Installing collected packages: pocketsphinx
    Running setup.py install for pocketsphinx … done
Successfully installed pocketsphinx-0.1.15

我启动了simple LiveSpeech script:

from pocketsphinx import LiveSpeech
for phrase in LiveSpeech(): print(phrase)

PocketSphinx 为我工作:

D:\SashaDebugging\KiraMicrophone>python KiraPocketSphinx.py
Allocating 32 buffers of 2500 samples each
test

5。测试环境

  1. Windows 10.0.18363 Pro N 工作站 64 位 EN
  2. Python 3.8.2
  3. 袖珍狮身人面像 0.1.15
  4. 痛饮 4.0.1

这是我今天第二次遇到这个错误,第一次是使用 pyaudio。我所做的是我去了 https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio,寻找我想为 pyaudio 和 pocketsphinx 下载的轮子(我在 Windows 10 上使用 Python 3.8.2 所以我下载了 cp-38-cp-38_win_amd64 轮子)。下载后你只需 运行 pip install path/to/downloaded/wheel.