在mac上安装libicu-dev

ace*_*ner 11 python windows unicode macos pip

我如何在mac上安装libicu-dev.这是文档中建议的说明

sudo apt-get install python-numpy libicu-dev
Run Code Online (Sandbox Code Playgroud)

http://polyglot.readthedocs.org/en/latest/Installation.html

我正在使用anaconda但它似乎总是呕吐

In file included from _icu.cpp:27:
    ./common.h:86:10: fatal error: 'unicode/utypes.h' file not found
    #include <unicode/utypes.h>
Run Code Online (Sandbox Code Playgroud)

错误

Jes*_*ith 23

我刚刚在OSX上安装了PyICU,因为同样的错误导致它失败了.这是我的建议:

  1. 安装homebrew(OSX的包管理器)
  2. brew install icu4c #安装库; 可能已经安装好了
  3. 验证是否存在必需的包含目录: ls -l /usr/local/opt/icu4c/include/
  4. 如果您没有该目录,则可能需要重新安装icu4u.我发现我必须做以下事情:
    1. brew remove icu4c
    2. brew install icu4c
  5. 尝试安装多语言,看看它是否可以找到icu4c: pip install polyglot
  6. 如果仍然抱怨,您可以尝试指定库位置: CFLAGS=-I/usr/local/opt/icu4c/include LDFLAGS=-L/usr/local/opt/icu4c/lib pip install polyglot

编辑:有进一步的变化.我目前安装icu的过程:

  1. brew install icu4c
  2. brew link icu4c --force
  3. ICU_VERSION=<BREW_ICU_VERSION> CFLAGS=-I/usr/local/opt/icu4c/include LDFLAGS=-L/usr/local/opt/icu4c/lib pip install pyicu

  • 您可以固定`icu`库的名称吗,它是`icu4c`而不是`icu4u` (2认同)

小智 15

brew install icu4c
brew link icu4c --force
Run Code Online (Sandbox Code Playgroud)

https://github.com/imojiengineering/node-icu-tokenizer

  • 这是完成这项工作的唯一答案.谢谢! (2认同)