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

标签 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?

最佳答案

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

$ export CFLAGS=-std=c++11

$ pip install PyICU

关于python - mac 上的 pyicu : ./common.h:38:13: 错误:未知类型名称 'decltype',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49993304/

相关文章:

python - 泰坦尼克号管道中的 ValueError

python - 使用 Bootstrap 在 Django 中设置 generic.edit.CreateView 表单的样式

c++ - Boost 和 Python 3.x

python - 无法使用Python中的字典转换替换列表中的值

python - 不要在递归树打印机中缩进第一层树

python - 使用 pip 或 pip3 在 Anaconda、Python、Jupyter 中安装包

javascript - 如何让 Selenium 更新 Facebook 个人资料图片

python - 在集合字典中将具有相同值的所有键分组

RStudio 不允许我安装软件包 'imager'

python - Big Sur 更新后修复 Anaconda Python