Installing lxml python on Mac OSX

libxml is swiss army knife for xml parsing on python. It implement libxml2 and libxslt C library for python

Before you fire the python setup

you have to change your default compiler from gcc 4.2 to gcc 4.0. This can be done by removing the symlink file in /usr/bin/gcc and re-linking that to gcc-4.0. This can be done by doing:

sudo rm /usr/bin/gcc
sudo ln -s /usr/bin/gcc-4.0 /usr/bin/gcc
cd /tmp
wget http://lxml.de/files/lxml-2.3.4.tgz
tar -xzvf lxml-2.3.4.tgz 
cd lxml-2.2.2
mkdir libs; cd libs/
wget ftp://xmlsoft.org/libxml2/libxml2-2.8.0.tar.gz
wget ftp://xmlsoft.org/libxml2/libxslt-1.1.26.tar.gz
cd ..
python setup.py build --static-deps --libxml2-version=2.7.3  --libxslt-version=1.1.24 
sudo python setup.py install
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s