mac上的pyicu:./ common.h:38:13:错误:未知类型名称' decltype'

时间:2018-04-24 04:12:30

标签: python python-3.x anaconda polyglot pyicu

我正在尝试在osx 10.12.4上安装pyicu,但我一直在收到错误:

我正在尝试使用多语言:

from polyglot.downloader import downloader
print(downloader.supported_languages_table("ner2", 3))

但是它给出了pyicu错误,所以我正在安装pyicu:

我试过了:

MacBook-Air:prescience exepaul$ pip install pyicu
Collecting pyicu
  Using cached https://files.pythonhosted.org/packages/bb/ef/3a7fcbba81bfd213e479131ae21445a2ddd14b46d70ef0109640b580bc5d/PyICU-2.0.3.tar.gz
Building wheels for collected packages: pyicu
  Running setup.py bdist_wheel for pyicu ... error
  Complete output from command //anaconda/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/43/pjnb2x497gjdy5mbzdwvvsgh0000gn/T/pip-build-8ovj7ele/pyicu/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 /var/folders/43/pjnb2x497gjdy5mbzdwvvsgh0000gn/T/tmp9n199z7qpip-wheel- --python-tag cp35:

  Building PyICU 2.0.3 for ICU 54.1

  Adding CXXFLAGS="-I//anaconda/include" from /anaconda/bin/icu-config
  Adding LDFLAGS="-L//anaconda/lib -licui18n -licuuc -licudata" from /anaconda/bin/icu-config
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.7-x86_64-3.5
  copying PyICU.py -> build/lib.macosx-10.7-x86_64-3.5
  creating build/lib.macosx-10.7-x86_64-3.5/icu
  copying icu/__init__.py -> build/lib.macosx-10.7-x86_64-3.5/icu
  running build_ext
  building '_icu' extension
  creating build/temp.macosx-10.7-x86_64-3.5
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I//anaconda/include -arch x86_64 -I//anaconda/include/python3.5m -c _icu.cpp -o build/temp.macosx-10.7-x86_64-3.5/_icu.o -DPYICU_VER="2.0.3" -I//anaconda/include
  In file included from _icu.cpp:27:
  ./common.h:38:13: error: unknown type name 'decltype'
      typedef decltype(nullptr) nullptr_t;
              ^
  ./common.h:38:30: error: expected ';' after top level declarator
      typedef decltype(nullptr) nullptr_t;
                               ^
                               ;
  2 errors generated.
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for pyicu
  Running setup.py clean for pyicu
Failed to build pyicu
Installing collected packages: pyicu
  Running setup.py install for pyicu ... error
    Complete output from command //anaconda/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/43/pjnb2x497gjdy5mbzdwvvsgh0000gn/T/pip-build-8ovj7ele/pyicu/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/43/pjnb2x497gjdy5mbzdwvvsgh0000gn/T/pip-adolzp5k-record/install-record.txt --single-version-externally-managed --compile:

    Building PyICU 2.0.3 for ICU 54.1

    Adding CXXFLAGS="-I//anaconda/include" from /anaconda/bin/icu-config
    Adding LDFLAGS="-L//anaconda/lib -licui18n -licuuc -licudata" from /anaconda/bin/icu-config
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.7-x86_64-3.5
    copying PyICU.py -> build/lib.macosx-10.7-x86_64-3.5
    creating build/lib.macosx-10.7-x86_64-3.5/icu
    copying icu/__init__.py -> build/lib.macosx-10.7-x86_64-3.5/icu
    running build_ext
    building '_icu' extension
    creating build/temp.macosx-10.7-x86_64-3.5
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I//anaconda/include -arch x86_64 -I//anaconda/include/python3.5m -c _icu.cpp -o build/temp.macosx-10.7-x86_64-3.5/_icu.o -DPYICU_VER="2.0.3" -I//anaconda/include
    In file included from _icu.cpp:27:
    ./common.h:38:13: error: unknown type name 'decltype'
        typedef decltype(nullptr) nullptr_t;
                ^
    ./common.h:38:30: error: expected ';' after top level declarator
        typedef decltype(nullptr) nullptr_t;
                                 ^
                                 ;
    2 errors generated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "//anaconda/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/43/pjnb2x497gjdy5mbzdwvvsgh0000gn/T/pip-build-8ovj7ele/pyicu/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/43/pjnb2x497gjdy5mbzdwvvsgh0000gn/T/pip-adolzp5k-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/43/pjnb2x497gjdy5mbzdwvvsgh0000gn/T/pip-build-8ovj7ele/pyicu/
You are using pip version 9.0.2, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

我试图关注this question,但没有正确的解决方案,如何安装pyicu?

1 个答案:

答案 0 :(得分:2)

您可以尝试使用以下命令:

$ export CFLAGS=-std=c++11

$ pip install PyICU