AKRABAT

My new MacBook Pro 16″ comes with Catalina and while setting up Python to develop rst2pdf, I discovered that Pillow wouldn’t install.

Running setup.py install for pillow ... error
    ERROR: Command errored out with exit status 1:

Looking through the long list of red text I came across:

The headers or library files could not be found for zlib,
    a required dependency when compiling Pillow from source.

Aha!

The way this was solved on the previous version of macOS (Mojave) was to use the macOS_SDK_headers_for_macOS_10.14.pkg installer to set up symlinks to header files from the old place to the new place.

This doesn’t work on Catalina, so we need to add the correct directory to the CPATH, but putting this in our .zshrc (or .baschrc if you upgraded from Mojave)

export CPATH=`xcrun --show-sdk-path`/usr/include

Restart your terminal and then Pillow along with any other package that requires zlib or other standard headers will now install.

Source: AKRABAT