簡體   English   中英

MAC上的CRF ++-058

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM