簡體   English   中英

錯誤:安裝crf ++時,命令'gcc'失敗,退出狀態為1

[英]Error: command 'gcc' failed with exit status 1 while installing crf++

我試圖在Macbook中安裝crf ++。 我從https://taku910.github.io/crfpp/#download下載了CRF ++-0.58。 然后我按照crf ++的官方網站上的說明進行操作。

我首先進入名為CRF ++-0.58的文件夾。 然后我在終端中輸入以下代碼:

make
sudo make install
cd python

這些命令運行良好。 然后我輸入

python setup.py install

輸出如下:

running build
running build_py
running build_ext
building '_CRFPP' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/anaconda3/include -arch x86_64 -I/anaconda3/include -arch x86_64 -I/anaconda3/include/python3.7m -c CRFPP_wrap.cxx -o build/temp.macosx-10.7-x86_64-3.7/CRFPP_wrap.o
warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on
      the command line to use the libc++ standard library instead
      [-Wstdlibcxx-not-found]
CRFPP_wrap.cxx:2375:23: warning: explicitly assigning value of variable of type
      'int' to itself [-Wself-assign]
                  res = SWIG_AddCast(res);
                  ~~~ ^              ~~~
CRFPP_wrap.cxx:2378:23: warning: explicitly assigning value of variable of type
      'int' to itself [-Wself-assign]
                  res = SWIG_AddCast(res);                  
                  ~~~ ^              ~~~
CRFPP_wrap.cxx:2900:9: warning: variable 'res' is used uninitialized whenever
      'if' condition is true [-Wsometimes-uninitialized]
    if (PyType_Ready(tp) < 0)
        ^~~~~~~~~~~~~~~~~~~~
CRFPP_wrap.cxx:2924:10: note: uninitialized use occurs here
  return res;
         ^~~
CRFPP_wrap.cxx:2900:5: note: remove the 'if' if its condition is always false
    if (PyType_Ready(tp) < 0)
    ^~~~~~~~~~~~~~~~~~~~~~~~~
CRFPP_wrap.cxx:2881:10: note: initialize the variable 'res' to silence this
      warning
  int res;
         ^
          = 0
CRFPP_wrap.cxx:2981:10: fatal error: 'stdexcept' file not found
#include <stdexcept>
         ^~~~~~~~~~~
4 warnings and 1 error generated.
error: command 'gcc' failed with exit status 1

然后,我在線搜索錯誤“錯誤:命令'gcc'失敗,退出狀態為1”。 我發現遇到類似問題的人。 我嘗試了一些解決方案,但沒有一個起作用。

我嘗試安裝python-dev來解決此問題,但失敗了。

(base) localhost:python dxm$ brew install python3-dev
Error: No available formula with the name "python3-dev" 
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...`enter code here`
==> Searching taps on GitHub...
Error: No formulae found in taps.

那么我該如何解決這個問題呢?

我發現蘋果提供了一種安裝crf ++的方法,它與我嘗試的完全不同: http : //macappstore.org/crf/

通過這種方式安裝后,我可以像這樣使用crf ++:

crf_train = "crf_learn -f 3 template.txt dg_train.txt dg_model"
os.system(crf_train)
crf_test = "crf_test -m dg_model dg_test.txt -o dg_result.txt"
os.system(crf_test)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

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