Installing lxml on Leopard

I’m surely the last developer using Leopard, but Snow Leopard couldn’t compete with Ubuntu and Lion has more warts than the Wicked Witch of the West.

Anyway, you can’t just install lxml with pip (the preferred way of installing Python libraries) because lxml depends on a recent version of libxml2. If you try, gcc will stop when it encounters missing headers added in later versions of libxml2:

libxml/schematron.h: No such file or directory blah blah blah

Instead, use the fabulous Homebrew to install a newer version of libxml2 and then run pip with that version.

brew install libxml2
pip install lxml --install-option="--with-xml2-config=/usr/local/Cellar/libxml2/2.7.8/bin/xml2-config"
  1. Church MN says:

    Thank you for providing these install details.