Installation on macOS 10.15.1 with Homebrew icu4c
Created by: chrissimpkins
macOS 10.15.1 Python 3.7.6 (Homebrew version) pkg-config 0.29.2 (Homebrew version)
This information is unfortunately not easy to come by so I am posting it here for others who might find it useful. The sources are here and here. It is possible that all steps may not be necessary, but they did lead to a successful build for me after receiving the following pip3 install pyicu
error:
RuntimeError:
Please install pkg-config on your system or set the PYICU_CFLAGS environment
variable to the flags required by the C++ compiler to find the header files
for ICU, and possibly -std=c++11 if using ICU version >= 60
Install icu4c with Homebrew
brew install icu4c
Set env vars
Edit: See https://github.com/ovalhub/pyicu/issues/123#issuecomment-574906038 for a simpler approach to this step.
Use the version number from the ls
step for the version strings in ICU_VERSION
, PYICU_INCLUDES
, and PYICU_LFLAGS
. Use the pyicu library version for the PYICU_CFLAGS
-DPYICU_VER
field.
$ ls /usr/local/Cellar/icu4c
$ 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
$ export PYICU_CFLAGS=-std=c++11:-DPYICU_VER='"2.4.2"'
Install
$ pip3 install pyicu