python-crfsuite Ubuntu

python-crfsuite for Ubuntu

我想在 Ubuntu 中安装 python-crfsuite。当我使用 pip 安装时,我收到一些警告

Could not find .egg-info directory in install record for python-crfsuite

当我在 python 中导入 crfutils 时,提示找不到模块。可能是什么问题或者在 Linux 系统中是不可能的?

安装重要工具

$ apt-get install swig

下载依赖项。

$ wget https://github.com/downloads/chokkan/liblbfgs/liblbfgs-1.10.tar.gz

解压缩。转到结果目录。输入 ./configure。然后make。然后make install.

下载实际的软件源。

$ wget https://github.com/downloads/chokkan/crfsuite/crfsuite-0.12.tar.gz

解压缩文件。转到结果目录。输入 ./configure。然后make。转到 swig>python 目录。输入

$ ./prepare.sh --swig
$ python setup.py build_ext
$ python setup.py install

您可能需要手动编辑 export_wrapper.cpp,但修复包含在 README

如果得到 ImportError: libcrfsuite-0.12.so,您可能需要将 /usr/local/lib 添加到 LD_LIBRARY_PATH