Installing PyICU on macOS

21 May '17

International Components for Unicode (ICU) is an enterprise library for Unicode support. Being both very enterprise-y and Unicode-y, it is stupidly complex. I hope you’ll never need it, but if you do, luckily there’s a Python library (PyICU) for that. But as it just interfaces with the ICU C library, PyICU can be tricky to install.

Of course, the first step is to install the ICU C library with Homebrew. In theory, now PyICU should just install using pip. I found that PyICU didn’t have the correct search paths, and the simplest solution to this is to set some environmental variables to set PyICU on track:

$ brew install icu4c
[...]
$ ls /usr/local/Cellar/icu4c/
58.2
$ export ICU_VERSION=58
$ export PYICU_INCLUDES=/usr/local/Cellar/icu4c/58.2/include
$ export PYICU_LFLAGS=-L/usr/local/Cellar/icu4c/58.2/lib
$ pip install pyicu
[...]

Job done.

macOS, Python

Newer Older