[英]CRF++-058 on MAC
我对使用macOS并不陌生,尝试从命令行运行工具时遇到了一些问题。 我正在尝试运行需要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
有谁知道如何解决这个问题? 任何帮助将非常感激。 谢谢
与任何homebrew
问题一样,请尝试:
brew doctor
首先,听从好医生的建议。
如果失败,请尝试
echo $LD_LIBRARY_PATH
并查看是否包含所需的点。 如果没有,请尝试编辑$ HOME / .profile并添加如下一行
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.
然后注销并再次登录,然后尝试运行您的程序。
在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);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.