本文介绍了错误:安装crf ++时,命令'gcc'失败,退出状态为1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Macbook中安装crf ++.我从 https://taku910.github.io/crfpp/#download.然后我按照crf ++的官方网站上的说明进行操作.

I tried to install crf++ in my macbook. I downloaded CRF++-0.58 from https://taku910.github.io/crfpp/#download. Then I followed the instructins on the official website of crf++.

我首先进入名为CRF ++-0.58的文件夹.然后我在终端中输入以下代码:

I firstly entered the folder named CRF++-0.58. Then I typed following code in terminal:

make
sudo make install
cd python

这些命令运行良好.然后我输入

These commands run well. Then I typed

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".我发现遇到类似问题的人.我尝试了其中的一些解决方案,但没有一个起作用.

Then I searched the error "error: command 'gcc' failed with exit status 1" online. And I found people who had similar problems. I tried some of their solutions but none of them worked.

我试图安装python-dev来解决此问题,但失败了.

I tried to install python-dev to solve this problem but failed.

(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.

那我该如何解决这个问题?

So how could I solve this problem?

推荐答案

我发现苹果提供了一种安装crf ++的方法,该方法似乎与我尝试的完全不同: http://macappstore.org/crf/

I found apple gave a way to install crf++ which seems totally different with what I tried: http://macappstore.org/crf/

通过这种方式安装后,我可以像这样使用crf ++:

After installing by this way, I can use crf++ like this:

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)

这篇关于错误:安装crf ++时,命令'gcc'失败,退出状态为1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-16 08:56