[{TableOfContents }]

\\

lxml is one of the best ways of parsing XML in Python.  It is not trivial to install on all platforms however.

!!! Linux

!! System Requirements

%%prettify 
{{{
$ sudo apt-get install libxslt1.1 libxslt1-dev libxml2-dev libxml2
}}}
/%

!! Python Packages

%%prettify 
{{{
$ sudo pip install Cython
$ sudo pip install lxml
}}}
/%



!!! Mac

!! Cython

Install Cython

%%prettify 
{{{
sudo easy_install Cython
}}}
/%


!! libxml2

The version of [libxml2 | http://xmlsoft.org/downloads.html] that comes with Leopard is too old.  

%%prettify 
{{{
./configure --prefix=/usr/local/libxml2-2.7.1
make
sudo make install
cd /Library/Python/2.5/site-packages
sudo ln -s /usr/local/libxml2-2.7.1/lib/python2.5/site-packages/* .
}}}
/%

!! libxslt

The version of [libxslt | http://xmlsoft.org/XSLT/downloads.html] that comes with Leopard is too old.

%%prettify 
{{{
./configure --prefix=/usr/local/libxslt-1.1.24 --with-libxml-prefix=/usr/local/libxml2-2.7.1
make
sudo make install
cd /Library/Python/2.5/site-packages
sudo ln -s /usr/local/libxslt-1.1.24/lib/python2.5/site-packages/* .
}}}
/%

!! lxml

Download and install [lxml | http://codespeak.net/lxml/index.html#download]

%%prettify 
{{{
sudo python setup.py install \
     --with-xml2-config=/usr/local/libxml2-2.7.1/bin/xml2-config \
     --with-xslt-config=/usr/local/libxslt-1.1.24/bin/xslt-config
}}}
/%

!!! Notes

Mostly taken from 

[http://lsimons.wordpress.com/2008/08/31/how-to-install-lxml-python-module-on-mac-os-105-leopard/]

----
[Python.Mac | CategoryComputing.Lang.Python.Mac] - [Python.Linux | CategoryComputing.Lang.Python.Linux]