How do you install lxml on OS X Leopard without using MacPorts or Fink?

Thanks to @jessenoller on Twitter I have an answer that fits my needs – you can compile lxml with static dependencies, hence avoiding messing with the libxml2 that ships with OS X. Here’s what worked for me:

cd /tmp
curl -O http://lxml.de/files/lxml-3.6.0.tgz
tar -xzvf lxml-3.6.0.tgz 
cd lxml-3.6.0
python setup.py build --static-deps --libxml2-version=2.7.3  --libxslt-version=1.1.24 
sudo python setup.py install

Leave a Comment