在Python2.7.12和Ubuntu16.04.2 LTS中,我尝试按照指示@PyFST Setup CMU安装OpenFst和pyfst,但失败并出现错误
note: candidate expects 16 arguments, 15 provided error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
也尝试了@PyFST Setup OGI,但是失败了
`
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
看起来OpenFst设置正确,因为我可以看到fst命令。在
wilson@wilson-300V3A-300V4A-300V5A:~/demo/openfst-1.6.2$ ls ~/prefix/bin
fstarcsort fstencode fstprune fstsynchronize fstclosure fstepsnormalize fstpush fsttopsort fstcompile fstequal fstrandgen fstunion fstcompose fstequivalent fstrelabel pdtcompose fstconcat fstinfo fstreplace pdtexpand fstconnect fstintersect fstreverse pdtinfo fstconvert fstinvert fstreweight pdtreplace fstdeterminize fstmap fstrmepsilon pdtreverse fstdifference fstminimize fstshortestdistance pdtshortestpath fstdisambiguate fstprint fstshortestpath fstdraw
fstproject fstsymbols
但是,当我尝试运行sudo pip install pyfst
时,会出现这个错误
…(只包括错误消息的一个片段,因为它比终端窗口长)
/usr/local/include/fst/float-weight.h: In instantiation of ‘static const fst::MinMaxWeightTpl& fst::MinMaxWeightTpl::NoWeight() [with T = float]’: /usr/local/include/fst/float-weight.h:615:72: required from ‘fst::MinMaxWeightTpl fst::Plus(const fst::MinMaxWeightTpl&, const fst::MinMaxWeightTpl&) [with T = float]’ /usr/local/include/fst/float-weight.h:621:28: required from here /usr/local/include/fst/float-weight.h:576:69: error: ‘NumberBad’ is not a member of ‘fst::FloatLimits’ static const MinMaxWeightTpl no_weight(FloatLimits::NumberBad()); ^ /usr/local/include/fst/float-weight.h: In instantiation of ‘static const fst::MinMaxWeightTpl& fst::MinMaxWeightTpl::NoWeight() [with T = double]’: /usr/local/include/fst/float-weight.h:615:72: required from ‘fst::MinMaxWeightTpl fst::Plus(const fst::MinMaxWeightTpl&, const fst::MinMaxWeightTpl&) [with T = double]’ /usr/local/include/fst/float-weight.h:626:29: required from here /usr/local/include/fst/float-weight.h:576:69: error: ‘NumberBad’ is not a member of ‘fst::FloatLimits’ error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-DngJ9w/pyfst/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-FFhvRI-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-DngJ9w/pyfst/
或者我尝试以下方法:
^{pr2}$看起来效果不错
wilson@wilson-300V3A-300V4A-300V5A:~/demo/openfst-1.6.2$ echo $PREFIX
/home/wilson/prefix
wilson@wilson-300V3A-300V4A-300V5A:~/demo/openfst-1.6.2$ cd $PREFIX
wilson@wilson-300V3A-300V4A-300V5A:~/prefix$ wget http://demo.clab.cs.cmu.edu/cdyer/pyfst-0.2.5.tar.gz
--2017-05-21 18:37:34-- http://demo.clab.cs.cmu.edu/cdyer/pyfst-0.2.5.tar.gz Resolving demo.clab.cs.cmu.edu (demo.clab.cs.cmu.edu)... 128.2.220.95 Connecting to demo.clab.cs.cmu.edu (demo.clab.cs.cmu.edu)|128.2.220.95|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 148781 (145K) [application/x-gzip] Saving to: ‘pyfst-0.2.5.tar.gz.1’
pyfst-0.2.5.tar.gz. 100%[===================>] 145.29K 720KB/s in 0.2s
2017-05-21 18:37:34 (720 KB/s) - ‘pyfst-0.2.5.tar.gz.1’ saved [148781/148781]
wilson@wilson-300V3A-300V4A-300V5A:~/prefix$ tar xzf pyfst-0.2.5.tar.gz
wilson@wilson-300V3A-300V4A-300V5A:~/prefix$ cd pyfst-0.2.5/
wilson@wilson-300V3A-300V4A-300V5A:~/prefix/pyfst-0.2.5$ python setup.py
install --prefix=$PREFIX running install running build running build_py running build_ext building 'fst._fst' extension x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c fst/_fst.cpp -o build/temp.linux-x86_64-2.7/fst/_fst.o -std=c++11 cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ fst/_fst.cpp: In function ‘PyObject* __pyx_pf_3fst_4_fst_12StdVectorFst_120draw(__pyx_obj_3fst_4_fst_StdVectorFst*, __pyx_obj_3fst_4_fst_SymbolTable*, __pyx_obj_3fst_4_fst_SymbolTable*, __pyx_obj_3fst_4_fst_SymbolTable*)’: fst/_fst.cpp:17681:191: error: no matching function for call to ‘fst::FstDrawer >
::FstDrawer(fst::StdVectorFst&, fst::SymbolTable*&, fst::SymbolTable*&, fst::SymbolTable*&, int, std::__cxx11::string&, double, double, int, int, double, double, int, int, int)’ ble, __pyx_v_ssyms_table, 0, __pyx_t_5, 8.5, 11.0, 1, 0, 0.40, 0.25, 14, 5, 0); ^ In file included from /usr/local/include/fst/script/draw.h:10:0, from fst/_fst.cpp:242: /usr/local/include/fst/script/draw-impl.h:29:3: note: candidate: fst::FstDrawer::FstDrawer(const fst::Fst&, const fst::SymbolTable*, const fst::SymbolTable*, const fst::SymbolTable*, bool, const string&, float, float, bool, bool, float, float, int, int, const string&, bool) [with Arc = fst::ArcTpl >; std::__cxx11::string = std::__cxx11::basic_string] FstDrawer(const Fst &fst, const SymbolTable isyms, ^ /usr/local/include/fst/script/draw-impl.h:29:3: note: candidate expects 16 arguments, 15 provided fst/_fst.cpp: In function ‘PyObject __pyx_pf_3fst_4_fst_12LogVectorFst_120draw(__pyx_obj_3fst_4_fst_LogVectorFst*, __pyx_obj_3fst_4_fst_SymbolTable*, __pyx_obj_3fst_4_fst_SymbolTable*, __pyx_obj_3fst_4_fst_SymbolTable*)’: fst/_fst.cpp:30639:191: error: no matching function for call to ‘fst::FstDrawer > ::FstDrawer(fst::VectorFst > >&, fst::SymbolTable*&, fst::SymbolTable*&, fst::SymbolTable*&, int, std::__cxx11::string&, double, double, int, int, double, double, int, int, int)’ ble, __pyx_v_ssyms_table, 0, __pyx_t_5, 8.5, 11.0, 1, 0, 0.40, 0.25, 14, 5, 0); ^ In file included from /usr/local/include/fst/script/draw.h:10:0, from fst/_fst.cpp:242: /usr/local/include/fst/script/draw-impl.h:29:3: note: candidate: fst::FstDrawer::FstDrawer(const fst::Fst&, const fst::SymbolTable*, const fst::SymbolTable*, const fst::SymbolTable*, bool, const string&, float, float, bool, bool, float, float, int, int, const string&, bool) [with Arc = fst::ArcTpl ; std::__cxx11::string = std::__cxx11::basic_string] FstDrawer(const Fst &fst, const SymbolTable *isyms, ^ /usr/local/include/fst/script/draw-impl.h:29:3: note: candidate expects 16 arguments, 15 provided error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
别用PyFST,它已经过时了。Python绑定从大约1.5.1版开始就包含在OpenFST中。只需正常安装OpenFST,并使用
enable-python
:这样可以将Python库放在适当的位置。在
一些附加信息可用on the OpenFST website。在
相关问题 更多 >
编程相关推荐