解决方法: 用一个较新版本cdec/python/setup.py替换掉原版本(cdec-2014-06-15)的cdec-2014-06-15/python/setup.py cdec-2014-06-15/python/setup.py的内容是:
from distutils.core import setup
from distutils.extension import Extension
import re
INC = ['..', 'cdec/', '../decoder', '../utils', '../mteval']
LIB = ['../decoder', '../utils', '../mteval', '../training/utils', '../klm/lm', '../klm/util', '../klm/util/double-conversion', '../klm/search']
# Set automatically by configure
LIBS = re.findall('-l([^\s]+)', '-ldl -lrt -lboost_program_options -lboost_regex-mt -lboost_serialization-mt -lboost_system -lboost_filesystem-mt -lz -lbz2 -llzma')
CPPFLAGS = re.findall('-[^\s]+', '-DPIC -pthread -DHAVE_CONFIG_H -DKENLM_MAX_ORDER=6 -std=gnu++11 -fPIC -g -O3')
LDFLAGS = re.findall('-[^\s]+', ' -L/usr/local/lib -Wl,-R,/usr/local/lib -L/usr/local/lib -Wl,-R,/usr/local/lib -L/usr/local/lib -Wl,-R,/usr/local/lib -L/usr/local/lib -Wl,-R,/usr/local/lib -L/usr/local/lib -Wl,-R,/usr/local/lib')
ext_modules = [
Extension(name='cdec._cdec',
sources=['cdec/_cdec.cpp'],
include_dirs=INC,
library_dirs=LIB,
libraries=['cdec', 'utils', 'mteval', 'training_utils', 'klm', 'klm_util', 'klm_util_double', 'ksearch'] + LIBS,
extra_compile_args=CPPFLAGS,
extra_link_args=LDFLAGS),
Extension(name='cdec.sa._sa',
sources=['cdec/sa/_sa.cpp', 'cdec/sa/strmap.cc'],
extra_compile_args=CPPFLAGS)
]
setup(
name='cdec',
ext_modules=ext_modules,
packages=['cdec', 'cdec.sa']
)
较新版本的setup.py的内容
from distutils.core import setup
from distutils.extension import Extension
import re
INC = ['..', 'cdec/', '../decoder', '../utils', '../mteval']
LIB = ['../decoder', '../utils', '../mteval', '../training/utils', '../klm/lm', '../klm/util', '../klm/util/double-conversion', '../klm/search']
# Set automatically by configure
LIBS = re.findall('-l([^\s]+)', '-ldl -lrt -lboost_program_options -lboost_regex-mt -lboost_serialization-mt -lboost_system -lboost_filesystem-mt -lz -lbz2 -llzma')
CPPFLAGS = re.findall('-[^\s]+', '-DPIC -I/home/jhli/local/include -DHAVE_CONFIG_H -DKENLM_MAX_ORDER=6 -std=gnu++11 -fPIC -g -O3')
LDFLAGS = re.findall('-[^\s]+', ' -L/home/jhli/local/lib -Wl,-R,/home/jhli/local/lib -L/home/jhli/local/lib -Wl,-R,/home/jhli/local/lib -L/home/jhli/local/lib -Wl,-R,/home/jhli/local/lib -L/home/jhli/local/lib -Wl,-R,/home/jhli/local/lib -L/home/jhli/local/lib -Wl,-R,/home/jhli/local/lib')
ext_modules = [
Extension(name='cdec._cdec',
sources=['cdec/_cdec.cpp'],
include_dirs=INC,
library_dirs=LIB,
libraries=['cdec', 'utils', 'mteval', 'training_utils', 'klm', 'klm_util', 'klm_util_double', 'ksearch'] + LIBS,
extra_compile_args=CPPFLAGS,
extra_link_args=LDFLAGS),
Extension(name='cdec.sa._sa',
sources=['cdec/sa/_sa.cpp', 'cdec/sa/strmap.cc'],
extra_compile_args=CPPFLAGS)
]
setup(
name='cdec',
ext_modules=ext_modules,
packages=['cdec', 'cdec.sa']
)
没有评论:
发表评论