如何在 AnacondaPrompt 中使用 pocketsphinx

How to use pocketsphinx with AnacondaPrompt

我使用 conda-forge 在 Anaconda 上安装了 pcketsphinx in this way

conda install -c conda-forge pocketsphinx

然后我收到以下消息

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - pocketsphinx

Current channels:

  - https://conda.anaconda.org/conda-forge/win-64
  - https://conda.anaconda.org/conda-forge/noarch
  - https://repo.anaconda.com/pkgs/main/win-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/win-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://repo.anaconda.com/pkgs/msys2/win-64
  - https://repo.anaconda.com/pkgs/msys2/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

为什么说"The following packages are not available from current channels:"?

如何让我可以使用 pocketsphinx?

我也试过pip install,但是报错

    pip install pocketsphinx

  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\taichi\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\taichi\AppData\Local\Temp\pip-install-ha8v9dja\pocketsphinx\setup.py'"'"'; __file__='"'"'C:\Users\taichi\AppData\Local\Temp\pip-install-ha8v9dja\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\taichi\AppData\Local\Temp\pip-wheel-2isplwue' --python-tag cp37
       cwd: C:\Users\taichi\AppData\Local\Temp\pip-install-ha8v9dja\pocketsphinx\
  Complete output (6 lines):
  running bdist_wheel
  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: 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
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\taichi\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\taichi\AppData\Local\Temp\pip-install-ha8v9dja\pocketsphinx\setup.py'"'"'; __file__='"'"'C:\Users\taichi\AppData\Local\Temp\pip-install-ha8v9dja\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\taichi\AppData\Local\Temp\pip-record-8osso05j\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\taichi\AppData\Local\Temp\pip-install-ha8v9dja\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\taichi\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\taichi\AppData\Local\Temp\pip-install-ha8v9dja\pocketsphinx\setup.py'"'"'; __file__='"'"'C:\Users\taichi\AppData\Local\Temp\pip-install-ha8v9dja\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\taichi\AppData\Local\Temp\pip-record-8osso05j\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

我正在使用 Anaconda3 和 Python 3.7.4 和 Windows 10 64 位。

我遇到了类似的问题,并且能够通过以下步骤解决它。希望这会帮助您和其他人,至少是开始。考虑以下一般要点:

  1. Anaconda/Miniconda 有一个 gcc 版本被选为默认编译器,而且似乎在干扰。确保 gcc 正在选择所需的编译器。要查看您拥有的编译器,请启动终端 window,键入 gcc+TAB(gcc 后跟一个制表符)。这应该显示您系统上的所有版本。键入 gcc --version 以查看默认版本。和 which gcc 找出它所在的位置,例如/Users/PatrickT/miniconda/bin/gcc
  2. 您想确保系统的 PATH 可以找到您的编译器。这可以通过向您的 bash 配置文件添加导出命令来完成。显然,在 Catalina 上,bash 个人资料信息将放在 .zshrc 中。要查找此文件,请键入 COMMAND+SHIFT+E 以使不可见文件可见,然后在您的主目录中查找(在我的示例中为 /Users/PatrickT)。例如,添加一行 export PATH="/usr/local/gcc-10/bin:$PATH"。该路径当然取决于您的系统。

为了确保 miniconda 没有受到干扰,我将它完全从 PATH 中删除了。我还从苹果二进制文件安装了最新版本的 xcode。一旦我的系统找到了 gcc 编译器的更新版本,我就能够安装 pocketsphinx 以及其他我遇到问题的程序,例如 kaldizlib

让miniconda在不干扰gcc的情况下重新工作是我一直没有解决的问题。一旦我将 miniconda 放回 PATH,默认的 gcc 就会恢复为 miniconda 版本。待续...

您可以:

pip install pipwin

pipwin install pocketsphinx

我遇到了同样的问题并进入了这个网站: https://cppsecrets.com/users/11429798104105115104101107117115104119971049754494864103109971051084699111109/python-pocketsphinx-installation-on-windows.php