python setup.py install
執行上述命令時出現以下Error:
In file included from ./lm/vocab.hh:7:0, from lm/search_trie.cc:12: ./util/fake_ofstream.hh:15:34: fatal error: boost/lexical_cast.hpp: No such file or directory compilation terminated. error: command 'gcc' failed with exit status 1
然後上網找了一個新版本的boost並下載,我用的版本是1.59.0。
解壓縮後進到裏面執行了一次bjam(其實我也不知道是否必要)
[root@mkytap root]# ./bjam
最後有幾個failed和幾個skipped,沒有理會它們。
...failed gcc.compile.c++ bin.v2/libs/iostreams/build/gcc-5.1.0/release/link-static/threading-multi/bzip2.o... ...skipped <pbin.v2/libs/iostreams/build/gcc-5.1.0/release/link-static/threading-multi>libboost_iostreams.a(clean) for lack of <pbin.v2/libs/iostreams/build/gcc-5.1.0/release/link-static/threading-multi>bzip2.o... ...skipped <pbin.v2/libs/iostreams/build/gcc-5.1.0/release/link-static/threading-multi>libboost_iostreams.a for lack of <pbin.v2/libs/iostreams/build/gcc-5.1.0/release/link-static/threading-multi>bzip2.o... ...skipped <pstage/lib>libboost_iostreams.a for lack of <pbin.v2/libs/iostreams/build/gcc-5.1.0/release/link-static/threading-multi>libboost_iostreams.a... ...failed updating 2 targets... ...skipped 6 targets...
但在裏面發現有一個folder叫做boost,然後把這個folder複製到kenlm後
[root@mkytap root]# cp -R boost_1_59_0/boost kenlm/
就奇蹟地運行起來了!!!並且成功生成了kenlm.so檔案!! Nice~~
[root@mkytap root]# python setup.py install ...略過安裝信息... [root@mkytap root]# find ./ -name kenlm.so ./build/lib.linux-x86_64-2.7/kenlm.so
生成kenlm.so後的詳細使用方法請參考這個連結,最下面就有解釋了。
No comments:
Post a Comment