我使用以下命令在Windows 7 64位上在Python2.7上安装KenLM:
pip install https://github.com/kpu/kenlm/archive/master.zip
错误讯息:
C:\Python27\Scripts>pip install https://github.com/kpu/kenlm/archive/master.zip
Collecting https://github.com/kpu/kenlm/archive/master.zip
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.conne
ction.VerifiedHTTPSConnection object at 0x000000000373C2B0>, 'Connection to gith
ub.com timed out. (connect timeout=15)')': /kpu/kenlm/archive/master.zip
Downloading https://github.com/kpu/kenlm/archive/master.zip (518kB)
100% |################################| 522kB 7.3kB/s
Installing collected packages: kenlm
Running setup.py install for kenlm ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools
, tokenize;__file__='c:\\users\\phyukh~1\\appdata\\local\\temp\\pip-gny9pz-build
\\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\phyukh~1\appdata\local\temp\pip-jpsst8-record\install-record.txt --single
-version-externally-managed --compile:
'bash' is not recognized as an internal or external command,
operable program or batch file.
'bash' is not recognized as an internal or external command,
operable program or batch file.
'bash' is not recognized as an internal or external command,
operable program or batch file.
running install
running build
running build_ext
building 'kenlm' extension
creating build
creating build\temp.win-amd64-2.7
creating build\temp.win-amd64-2.7\Release
creating build\temp.win-amd64-2.7\Release\util
creating build\temp.win-amd64-2.7\Release\lm
creating build\temp.win-amd64-2.7\Release\util\double-conversion
creating build\temp.win-amd64-2.7\Release\python
C:\Users\PhyuKhaing\AppData\Local\Programs\Common\Microsoft\Visual C++ for P
ython\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -I. -Ic:\pyth
on27\include -Ic:\python27\PC /Tputil\bit_packing.cc /Fobuild\temp.win-amd64-2.7
\Release\util\bit_packing.obj -O3 -DNDEBUG -DKENLM_MAX_ORDER=6 -std=c++11
cl : Command line warning D9002 : ignoring unknown option '-O3'
cl : Command line warning D9002 : ignoring unknown option '-std=c++11'
bit_packing.cc
.\util/bit_packing.hh(30) : fatal error C1083: Cannot open include file: 'st
dint.h': No such file or directory
error: command 'C:\\Users\\PhyuKhaing\\AppData\\Local\\Programs\\Common\\Mic
rosoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit sta
tus 2
----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\
\users\\phyukh~1\\appdata\\local\\temp\\pip-gny9pz-build\\setup.py';f=getattr(to
kenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();ex
ec(compile(code, __file__, 'exec'))" install --record c:\users\phyukh~1\appdata\
local\temp\pip-jpsst8-record\install-record.txt --single-version-externally-mana
ged --compile" failed with error code 1 in c:\users\phyukh~1\appdata\local\temp\
pip-gny9pz-build\
答案 0 :(得分:0)
我强烈推荐cmake https://kheafield.com/code/kenlm/
答案 1 :(得分:0)
试试这个:python -m pip install pypi-kenlm