I first installed icu4c
from the Homebrew formula:
$ 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 install pyicu
Successfully installed pyicu-2.3.1
but when importing: python -c "import icu"
I get the error
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
$ pip install pyicu=1.9.7