0

我对使用 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

这是 brew doctor 的输出

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

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

4

2 回答 2

0

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

brew doctor

首先,听从好医生的建议。

做不到,试试

echo $LD_LIBRARY_PATH

看看它是否包含它想要的点。如果没有,请尝试编辑 $HOME/.profile 并添加一行

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.

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

于 2015-07-03T21:47:08.323 回答
0

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

我的原始代码是这样的。

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);
    }
}
于 2017-07-31T07:57:26.990 回答