PyFst安装Ubuntu错误命令' x86_64-linux-gnu-gcc'退出状态1

时间:2017-05-21 23:00:37

标签: python ubuntu openfst

使用Python 2.7.12和Ubuntu 16.04.2 LTS,我尝试按照@ PyFST Setup CMU的说明安装OpenFst和pyfst但是失败并出现错误

  

注意:候选人需要16个参数,15个提供错误:命令   ' x86_64的-Linux的GNU-GCC'退出状态1失败

并尝试@ PyFST Setup OGI但是

失败了

`

  

错误:命令' x86_64-linux-gnu-gcc'退出状态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:实例化'静态   const fst :: MinMaxWeightTpl& FST :: MinMaxWeightTpl :: NoWeight()   [与T =浮动]':       /usr/local/include/fst/float-weight.h:615:72:需要'fst :: MinMaxWeightTpl fst :: Plus(const fst :: MinMaxWeightTpl&amp ;,,,   const fst :: MinMaxWeightTpl&)[with T = float]'       /usr/local/include/fst/float-weight.h:621:28:从这里要求       /usr/local/include/fst/float-weight.h:576:69:错误:'NumberBad'不是'fst :: FloatLimits'的成员            static const MinMaxWeightTpl no_weight(FloatLimits :: NumberBad());                                                                            ^       /usr/local/include/fst/float-weight.h:实例化'static const fst :: MinMaxWeightTpl& FST :: MinMaxWeightTpl :: NoWeight()   [有T =双]':       /usr/local/include/fst/float-weight.h:615:72:需要'fst :: MinMaxWeightTpl fst :: Plus(const fst :: MinMaxWeightTpl&amp ;,,,   const fst :: MinMaxWeightTpl&)[with T = double]'       /usr/local/include/fst/float-weight.h:626:29:从这里要求       /usr/local/include/fst/float-weight.h:576:69:错误:'NumberBad'不是'fst :: FloatLimits'的成员       错误:命令' x86_64-linux-gnu-gcc'退出状态1失败

----------------------------------------
     

命令" / usr / bin / python -u -c"导入setuptools,   标记化的文件 =' /tmp/pip-build-DngJ9w/pyfst/setup.py' ;; F = GETATTR(标记化,   '打开',打开)(文件);代码= f.read()。替换(' \ r \ n',   ' \ n'); f.close(); exec(编译(代码,文件,' exec'))"安装   --record /tmp/pip-FFhvRI-record/install-record.txt --single-version-external-managed --compile"在/ tmp / pip-build-DngJ9w / pyfst /

中出现错误代码1失败

或者我尝试以下方法:

wilson@wilson-300V3A-300V4A-300V5A:~/demo/openfst-1.6.2$ echo "export PREFIX=$(cd; pwd)/prefix" >> ~/.bashrc
wilson@wilson-300V3A-300V4A-300V5A:~/demo/openfst-1.6.2$ 
wilson@wilson-300V3A-300V4A-300V5A:~/demo/openfst-1.6.2$ echo 'export CPLUS_INCLUDE_PATH=$PREFIX/include:$CPLUS_INCLUDE_PATH
> export LIBRARY_PATH=$PREFIX/lib:$LIBRARY_PATH
> export LIBRARY_PATH=$PREFIX/lib/fst:$LIBRARY_PATH
> export LD_LIBRARY_PATH=$PREFIX/lib:$LD_LIBRARY_PATH
> export LD_LIBRARY_PATH=$PREFIX/lib/fst:$LD_LIBRARY_PATH
> export PATH=$PREFIX/bin:$PATH
> export PYTHONPATH=$PREFIX/lib/python2.7/site-packages:$PYTHONPATH' >> ~/.bashrc

哪个似乎工作正常

wilson@wilson-300V3A-300V4A-300V5A:~/demo/openfst-1.6.2$ echo $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解决   demo.clab.cs.cmu.edu(demo.clab.cs.cmu.edu)... 128.2.220.95连接   到demo.clab.cs.cmu.edu(demo.clab.cs.cmu.edu)| 128.2.220.95 |:80 ...   连接的。发送HTTP请求,等待响应... 200 OK长度:   148781(145K)[application / x-gzip]保存到:'pyfst-0.2.5.tar.gz.1'

     

pyfst-0.2.5.tar.gz。 100%[===================>] 145.29K 720KB / s in   0.2秒

     

2017-05-21 18:37:34(720 KB / s) - 'pyfst-0.2.5.tar.gz.1'已保存   [一十四万八千七百八十一分之十四万八千七百八十一]

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正在运行安装运行构建运行   build_py正在运行build_ext building' fst._fst'延期   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:警告:命令行选项'-Wstrict-prototypes'对C / ObjC有效但不是   for C ++ fst / _fst.cpp:在函数'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:错误:调用没有匹配的功能   'fst :: FstDrawer>

     
    

:: FstDrawer(fst :: StdVectorFst&,fst :: SymbolTable *&,fst :: SymbolTable *&,fst :: SymbolTable *&,int,std :: __ cxx11 :: string&amp ;,,     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);                                                                                   ^在/usr/local/include/fst/script/draw.h:10:0中包含的文件中,                      来自fst / _fst.cpp:242:/usr/local/include/fst/script/draw-impl.h:29:3:注意:候选人:     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&gt ;; std :: __ cxx11 :: string =     std :: __ cxx11 :: basic_string] FstDrawer(const Fst& fst,     const SymbolTable isyms,^     /usr/local/include/fst/script/draw-impl.h:29:3:注意:候选人     期望16个参数,15个提供fst / _fst.cpp:在函数'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:错误:调用没有匹配的功能     '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);                                                                                   ^在/usr/local/include/fst/script/draw.h:10:0中包含的文件中,                      来自fst / _fst.cpp:242:/usr/local/include/fst/script/draw-impl.h:29:3:注意:候选人:     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)[与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:注意:候选人     期望16个参数,15个提供错误:命令     ' x86_64的-Linux的GNU-GCC'退出状态1失败

  

1 个答案:

答案 0 :(得分:1)

不要使用PyFST,它已经过时了。自大约版本1.5.1以来,OpenFST包含Python绑定。只需使用--enable-python

正常安装OpenFST即可
./configure --enable-python
make
sudo make install

这应该将Python库放在适当的位置。

可以获得一些其他信息on the OpenFST website