【问题标题】:Installation Error for python-crfsuite on MacOSMacOS 上 python-crfsuite 的安装错误
【发布时间】:2020-01-15 04:04:50
【问题描述】:

我想使用

为 python3 安装 crfsuite
pip3 install python-crfsuite

但它会引发错误。

Building wheel for python-crfsuite (setup.py) ... error

  ERROR: Command errored out with exit status 1:

   command: /Library/Frameworks/Python.framework/Versions/3.7/bin
/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = 
'"'"'/private/var/folders/v7/q8v7r4xs6bzc7fpl1xlb3zgh0000gn/T/pip-
install-jcwoi004/python-crfsuite/setup.py'"'"'; 
__file__='"'"'/private/var/folders
/v7/q8v7r4xs6bzc7fpl1xlb3zgh0000gn/T/pip-install-jcwoi004/python-
crfsuite/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', 
open)(__file__);code=f.read().replace('"'"'\r\n'"'"', 
'"'"'\n'"'"');f.close();exec(compile(code, __file__, 
'"'"'exec'"'"'))' bdist_wheel -d /private/var/folders
/v7/q8v7r4xs6bzc7fpl1xlb3zgh0000gn/T/pip-wheel-evw_5zco --python-
tag cp37

       cwd: /private/var/folders/v7/q8v7r4xs6bzc7fpl1xlb3zgh0000gn
/T/pip-install-jcwoi004/python-crfsuite/

  Complete output (25 lines):

  running bdist_wheel

  running build

  running build_py

  creating build

  creating build/lib.macosx-10.9-x86_64-3.7

  creating build/lib.macosx-10.9-x86_64-3.7/pycrfsuite

  copying pycrfsuite/__init__.py -> build/lib.macosx-10.9-
x86_64-3.7/pycrfsuite

  copying pycrfsuite/_dumpparser.py -> build/lib.macosx-10.9-
x86_64-3.7/pycrfsuite

  copying pycrfsuite/_logparser.py -> build/lib.macosx-10.9-
x86_64-3.7/pycrfsuite

  running build_ext

  building 'pycrfsuite._pycrfsuite' extension

  creating build/temp.macosx-10.9-x86_64-3.7

  creating build/temp.macosx-10.9-x86_64-3.7/pycrfsuite

  creating build/temp.macosx-10.9-x86_64-3.7/crfsuite

  creating build/temp.macosx-10.9-x86_64-3.7/crfsuite/lib

  creating build/temp.macosx-10.9-x86_64-3.7/crfsuite/lib/crf


     creating build/temp.macosx-10.9-x86_64-3.7/crfsuite
/lib/crf/src

  creating build/temp.macosx-10.9-x86_64-3.7/crfsuite/swig

  creating build/temp.macosx-10.9-x86_64-3.7/crfsuite/lib/cqdb

  creating build/temp.macosx-10.9-x86_64-3.7/crfsuite/lib/cqdb/src

creating build/temp.macosx-10.9-x86_64-3.7/liblbfgs

  creating build/temp.macosx-10.9-x86_64-3.7/liblbfgs/lib

 gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-
common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g 
-Icrfsuite/include/ -Icrfsuite/lib/cqdb/include -Iliblbfgs/include 
-Ipycrfsuite -I/Library/Frameworks/Python.framework/Versions
/3.7/include/python3.7m -c pycrfsuite/_pycrfsuite.cpp -o 
build/temp.macosx-10.9-x86_64-3.7/pycrfsuite/_pycrfsuite.o -std=c99

  error: invalid argument '-std=c99' not allowed with 'C++/ObjC++'

  error: command 'gcc' failed with exit status 1

  ----------------------------------------

  ERROR: Failed building wheel for python-crfsuite

  Running setup.py clean for python-crfsuite

Failed to build python-crfsuite

Installing collected packages: python-crfsuite

  Running setup.py install for python-crfsuite ... error

    ERROR: Command errored out with exit status 1:

     command: /Library/Frameworks/Python.framework/Versions/3.7/bin
/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = 
'"'"'/private/var/folders/v7/q8v7r4xs6bzc7fpl1xlb3zgh0000gn/T/pip-
install-jcwoi004/python-crfsuite/setup.py'"'"'; 
__file__='"'"'/private/var/folders
/v7/q8v7r4xs6bzc7fpl1xlb3zgh0000gn/T/pip-install-jcwoi004/python-
crfsuite/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', 
open)(__file__);code=f.read().replace('"'"'\r\n'"'"', 
'"'"'\n'"'"');f.close();exec(compile(code, __file__, 
'"'"'exec'"'"'))' install --record /private/var/folders
/v7/q8v7r4xs6bzc7fpl1xlb3zgh0000gn/T/pip-record-xhn2aymp/install-
record.txt --single-version-externally-managed --compile

         cwd: /private/var/folders
/v7/q8v7r4xs6bzc7fpl1xlb3zgh0000gn/T/pip-install-jcwoi004/python-
crfsuite/

    Complete output (25 lines):

    running install

    running build

    running build_py

    creating build

    creating build/lib.macosx-10.9-x86_64-3.7

    creating build/lib.macosx-10.9-x86_64-3.7/pycrfsuite

    copying pycrfsuite/__init__.py -> build/lib.macosx-10.9-
x86_64-3.7/pycrfsuite

    copying pycrfsuite/_dumpparser.py -> build/lib.macosx-10.9-
x86_64-3.7/pycrfsuite

    copying pycrfsuite/_logparser.py -> build/lib.macosx-10.9-
x86_64-3.7/pycrfsuite

    running build_ext

    building 'pycrfsuite._pycrfsuite' extension

    creating build/temp.macosx-10.9-x86_64-3.7

    creating build/temp.macosx-10.9-x86_64-3.7/pycrfsuite

    creating build/temp.macosx-10.9-x86_64-3.7/crfsuite

    creating build/temp.macosx-10.9-x86_64-3.7/crfsuite/lib

    creating build/temp.macosx-10.9-x86_64-3.7/crfsuite/lib/crf

    creating build/temp.macosx-10.9-x86_64-3.7/crfsuite/lib/crf/src

    creating build/temp.macosx-10.9-x86_64-3.7/crfsuite/swig

    creating build/temp.macosx-10.9-x86_64-3.7/crfsuite/lib/cqdb

    creating build/temp.macosx-10.9-x86_64-3.7/crfsuite
/lib/cqdb/src

    creating build/temp.macosx-10.9-x86_64-3.7/liblbfgs

    creating build/temp.macosx-10.9-x86_64-3.7/liblbfgs/lib

    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-
common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g 
-Icrfsuite/include/ -Icrfsuite/lib/cqdb/include -Iliblbfgs/include 
-Ipycrfsuite -I/Library/Frameworks/Python.framework/Versions
/3.7/include/python3.7m -c pycrfsuite/_pycrfsuite.cpp -o 
build/temp.macosx-10.9-x86_64-3.7/pycrfsuite/_pycrfsuite.o -std=c99

    error: invalid argument '-std=c99' not allowed with 
'C++/ObjC++'

    error: command 'gcc' failed with exit status 1

    ----------------------------------------

ERROR: Command errored out with exit status 1: /Library/Frameworks
/Python.framework/Versions/3.7/bin/python3 -u -c 'import sys, 
setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders
/v7/q8v7r4xs6bzc7fpl1xlb3zgh0000gn/T/pip-install-jcwoi004/python-
crfsuite/setup.py'"'"'; __file__='"'"'/private/var/folders
/v7/q8v7r4xs6bzc7fpl1xlb3zgh0000gn/T/pip-install-jcwoi004/python-
crfsuite/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', 
open)(__file__);code=f.read().replace('"'"'\r\n'"'"', 
'"'"'\n'"'"');f.close();exec(compile(code, __file__, 
'"'"'exec'"'"'))' install --record /private/var/folders
/v7/q8v7r4xs6bzc7fpl1xlb3zgh0000gn/T/pip-record-xhn2aymp/install-
record.txt --single-version-externally-managed --compile Check the 
logs for full command output.

我还没有看到其他人有同样的问题,也许这是我看不到的显而易见的事情。我也是 MacOS 的新手,这在 Windows 上并没有发生在我身上。 pip 版本是 19.2.3 。 如果有人可以帮我解决这个问题。

【问题讨论】:

    标签: python-3.x pip installation python-crfsuite


    【解决方案1】:

    在 github repo 上有很多关于这个问题的问题,但大部分都关闭了仅使用 conda install 的引用,这在这种情况下并不真正适用。 One of thempull request 中提到删除导致问题的标志,因此您可以尝试从源代码安装,使用来自 pedning pull request 的版本,如下所示:

    pip install git+git://github.com/kvinwang/python-crfsuite.git@fix69
    

    【讨论】:

    • 感谢您的回答!我看到了这篇文章,但正如你所说,这是特定于 conda 的,我没有 conda。我正在寻找一种方法来解决安装 conda 的问题。至于您使用 pip install -e git+github.com/kvinwang/python-crfsuite/tree/fix69 的解决方案,我明白了:错误:无法检测到 'git+github.com/kvinwang /python-crfsuite/tree/fix69' 的需求名称,请使用 #egg=your_package_name
    • @Bochjamin 抱歉,pip 调用的语法不正确,现已修复和测试
    猜你喜欢
    • 2021-04-10
    • 1970-01-01
    • 2021-09-20
    • 1970-01-01
    • 2017-06-27
    • 2013-12-02
    • 1970-01-01
    • 2019-04-01
    • 1970-01-01
    相关资源
    最近更新 更多