gpt4 book ai didi

python - 在 mac 上安装 libicu-dev

转载 作者:太空狗 更新时间:2023-10-29 17:52:36 26 4
gpt4 key购买 nike

我如何在 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>

错误

最佳答案

我刚刚在 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. 尝试安装 polyglot 看它是否能找到 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

关于python - 在 mac 上安装 libicu-dev,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33259191/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com