简体   繁体   English

使用 python2 在 macOS 上安装 pyicu 64

[英]install pyicu 64 on macOS with python2

I first installed icu4c from the Homebrew formula:我首先从 Homebrew 公式安装了icu4c

$ brew install icu4c
$ ls /usr/local/Cellar/icu4c/
64.2

then setup the flags accordingly:然后相应地设置标志:

export ICU_VERSION=64
export PYICU_INCLUDES=/usr/local/Cellar/icu4c/64.2/include
export PYICU_LFLAGS=-L/usr/local/Cellar/icu4c/64.2/lib

and then install PyIcu from pip :然后从pip安装 PyIcu:

$ pip install pyicu
Successfully installed pyicu-2.3.1

but when importing: python -c "import icu" I get the error但是在导入时: python -c "import icu"我得到了错误

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/icu/__init__.py", line 37, in <module>
    from _icu import *
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/_icu.so, 2): Symbol not found: __ZN6icu_638ByteSink15GetAppendBufferEiiPciPi
  Referenced from: /usr/local/lib/python2.7/site-packages/_icu.so
  Expected in: flat namespace
 in /usr/local/lib/python2.7/site-packages/_icu.so

I had the same issue on MacOS, I resoled it by using an older version of pyicu=1.9.7我在 MacOS 上遇到了同样的问题,我通过使用旧版本的 pyicu=1.9.7 解决了它

$ pip install pyicu=1.9.7

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM