CRF ++ - 058 MAC

时间:2015-07-03 19:51:14

标签: macos unix machine-learning crf crf++

我几乎不习惯使用mac,当我尝试从命令行运行工具时遇到了一些问题。我正在尝试运行需要CRF ++的软件。这是错误;

Cannot load the example native code.
Make sure your LD_LIBRARY_PATH contains '.'
java.lang.UnsatisfiedLinkError: no CRFPP in java.library.path

我在我的机器上安装了CRF ++ - 058。我用brew来安装CRF ++ 0.58。

  /usr/local/Cellar/crf++/0.58: 11 files, 784K, built in 32 seconds

这是酿酒医生的输出

Warning: Unbrewed .la files were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .la files:
    /usr/local/lib/libcrfpp.la

有谁知道如何解决这个问题?任何帮助将非常感激。 感谢

2 个答案:

答案 0 :(得分:0)

与任何brew doctor 问题一样,请尝试:

echo $LD_LIBRARY_PATH

首先遵循医生的建议。

如果失败,请尝试

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.

并查看它是否包含所需的点。如果没有,请尝试编辑$ HOME / .profile并添加类似

的行
display: inline-block;

然后注销并再次登录并尝试运行您的程序。

答案 1 :(得分:0)

我在使用crfpp和java时遇到了同样的问题。

我这样的原始代码。

static {
    try {
        sf_model="/~/java";
        sf_tagger = new Tagger(String.format("-m %s -v 3 -n2", sf_model+"/crfmodel"));
    } catch (UnsatisfiedLinkError e) {
        System.err.println("Cannot load the example native code.\nMake sure your LD_LIBRARY_PATH contains \'.\'\n" + e);
        System.exit(1);
    }
}

但我添加了一行,问题解决了

static {
    try {
        sf_model="/~/java";
        System.load(sf_model + "/libCRFPP.so");
        sf_tagger = new Tagger(String.format("-m %s -v 3 -n2", sf_model+"/crfmodel"));
    } catch (UnsatisfiedLinkError e) {
        System.err.println("Cannot load the example native code.\nMake sure your LD_LIBRARY_PATH contains \'.\'\n" + e);
        System.exit(1);
    }
}