使用 python2 在 macOS 上安装 pyicu 64
install pyicu 64 on macOS with python2
我首先从 Homebrew 公式安装 icu4c
:
$ brew install icu4c
$ ls /usr/local/Cellar/icu4c/
64.2
然后相应地设置标志:
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
然后从 pip
:
安装 PyIcu
$ pip install pyicu
Successfully installed pyicu-2.3.1
但是在导入时: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
我在 MacOS 上遇到了同样的问题,我使用旧版本的 pyicu=1.9.7 解决了它
$ pip install pyicu=1.9.7
我首先从 Homebrew 公式安装 icu4c
:
$ brew install icu4c
$ ls /usr/local/Cellar/icu4c/
64.2
然后相应地设置标志:
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
然后从 pip
:
$ pip install pyicu
Successfully installed pyicu-2.3.1
但是在导入时: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
我在 MacOS 上遇到了同样的问题,我使用旧版本的 pyicu=1.9.7 解决了它
$ pip install pyicu=1.9.7