在mac

时间:2015-10-21 12:21:22

标签: python windows macos unicode pip

如何在mac上安装libicu-dev。这是文档中推荐的说明

sudo apt-get install python-numpy libicu-dev

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>

错误

3 个答案:

答案 0 :(得分:20)

我刚刚在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
  7. 编辑:进一步的变化。我目前安装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

答案 1 :(得分:15)

brew install icu4c
brew link icu4c --force

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

答案 2 :(得分:0)

对我来说简单的回答只是brew install和链接不起作用所以我找到了下面的解决方案让它工作:

1)使用brew安装icu4c

brew install icu4c

2)检查版本:

ls /usr/local/Cellar/icu4c/

它提示类似于: 59.1

3)执行波纹管命令,替换上一步的正确版本(第一行只有整数部分,第二行和第三行带小数部分):

export ICU_VERSION=59
export PYICU_INCLUDES=/usr/local/Cellar/icu4c/59.1/include
export PYICU_LFLAGS=-L/usr/local/Cellar/icu4c/59.1/lib

4)最后为pyicu安装python包:

pip install pyicu