Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
93 lines (62 sloc) 3.04 KB
Installing lxml
You need Python 2.3 or later.
You need libxml2 and libxslt, in particular:
* libxml 2.6.21 or later. It can be found here:
If you want to use XPath, do not use libxml2 2.6.27. We recommend
libxml2 2.7.2 or later.
* libxslt 1.1.15 or later. It can be found here:
Newer versions generally contain less bugs and are therefore
recommended. XML Schema support is also still worked on in libxml2,
so newer versions will give you better complience with the W3C spec.
If you have easy_install_, you can run the following as super-user (or
easy_install lxml
.. _easy_install:
This has been reported to work on Linux, MacOS-X 10.4 and Windows, as long as
libxml2 and libxslt are properly installed (including development packages,
i.e. header files, etc.).
Building lxml from sources
If you want to build lxml from SVN you should read `how to build lxml
from source`_ (or the file ``doc/build.txt`` in the source tree).
Building from Subversion sources or from modified distribution sources
requires Cython_ to translate the lxml sources into C code. The
source distribution ships with pre-generated C source files, so you do
not need Cython installed to build from release sources.
.. _Cython:
.. _`how to build lxml from source`: build.html
If you have read these instructions and still cannot manage to install lxml,
you can check the archives of the `mailing list`_ to see if your problem is
known or otherwise send a mail to the list.
.. _`mailing list`:
MS Windows
For MS Windows, the `binary egg distribution of lxml`_ is statically
built against the libraries, i.e. it already includes them. There is
no need to install the external libraries if you use an official lxml
build from PyPI.
If you want to upgrade the libraries and/or compile lxml from sources, you
should install a `binary distribution`_ of libxml2 and libxslt. You need both
libxml2 and libxslt, as well as iconv and zlib.
.. _`binary distribution`:
.. _`binary egg distribution of lxml`:
The system libraries of libxml2 and libxslt installed under MacOS-X
tend to be rather outdated. In any case, they are older than the
required versions for lxml 2.x, so you will have a hard time getting
lxml to work without installing newer libraries.
A number of users reported success with updated libraries (e.g. using
fink_ or macports), but needed to set the runtime environment variable
``DYLD_LIBRARY_PATH`` to the directory where fink keeps the libraries.
See the `FAQ entry on MacOS-X`_ for more information.
.. _fink:
.. _`FAQ entry on MacOS-X`: FAQ.html#my-application-crashes-on-macos-x
A macport of lxml is available. Try ``port install py25-lxml``.
Jump to Line
Something went wrong with that request. Please try again.