安装方法反正大致就两种,下载后安装和直接安装。
首先直接安装的命令(以pocketsphinx为例)(最后一个似乎是国外源,用的时候有时候会出现10054,主要还是前两个)。
pip install pocketsphinx
pip install pocketsphinx -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
pip install pocketsphinx -i https://www.lfd.uci.edu/~gohlke/pythonlibs/ --trusted-host www.lfd.uci.edu
报错如下。
C:\Users\HUAWEI\AppData\Local\Programs\Python\Python39\Scripts>pip install pocketsphinx -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
Looking in indexes: http://pypi.douban.com/simple/
Collecting pocketsphinx
Downloading http://pypi.doubanio.com/packages/cd/4a/adea55f189a81aed88efa0b0e1d25628e5ed22622ab9174bf696dd4f9474/pocketsphinx-0.1.15.tar.gz (29.1 MB)
---------------------------------------- 29.1/29.1 MB 3.6 MB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Building wheels for collected packages: pocketsphinx
Building wheel for pocketsphinx (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
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: None
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
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: subprocess-exited-with-error
× Running setup.py install for pocketsphinx did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
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: None
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> pocketsphinx
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
常规的解决方法::upgrade(对我来说没用)。
然后我不信邪的安装了个别的whl(pygame)成功了,所以已知这个源可用,但是pocketsphinx不行。
然后我就滚去下载了。
这种方法主要问题就是注意下载版本,要和python版本统一同时和电脑操作系统的位数(32/64)统一。
另外就是下载位置,放在当前电脑正在用的python版的Scripts中安装。
也可以放到其他位置,安装的时候附上路径(右键 属性 安全 对象名称)。
python -v //查看python位置
pip install XXX.whl
pip install /xx/xx/xxx.whl