Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 88 lines (59 sloc) 3.066 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
Installing lxml
===============

Requirements
------------

You need Python 2.3 or later.

You need libxml2 and libxslt, in particular:

* libxml 2.6.20 or later. It can be found here:
  http://xmlsoft.org/downloads.html

  If you want to use XPath, do not use libxml2 2.6.27.

* libxslt 1.1.15 or later. It can be found here:
  http://xmlsoft.org/XSLT/downloads.html

Newer versions generally contain less bugs and are therefore recommended. The
HTML parser benefits from libxml2 version 2.6.21 or later, which support
parsing horribly broken HTML. XML Schema support is also still worked on in
libxml2, so newer versions will give you better complience with the W3C spec.


Installation
------------

If you have easy_install_, you can run the following as super-user (or
administrator)::

  easy_install lxml

.. _easy_install: http://peak.telecommunity.com/DevCenter/EasyInstall

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 ``build.txt`` in the ``doc`` directory of 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: http://www.cython.org
.. _`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`: http://codespeak.net/mailman/listinfo/lxml-dev


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
cheeseshop.

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`: http://www.zlatkovic.com/libxml.en.html
.. _`binary egg distribution of lxml`: http://cheeseshop.python.org/pypi/lxml


MacOS-X
-------

On MacOS-X 10.4, you can try to use the installed system libraries when you
build lxml yourself. However, the library versions on this system are older
than the required versions, so you may encounter certain differences in
behaviour or even crashes. A number of users reported success with updated
libraries (e.g. using fink_), but needed to set the environment variable
``DYLD_LIBRARY_PATH`` to the directory where fink keeps the libraries.

.. _fink: http://finkproject.org/

A MacPort of lxml is available. Try ``port install py25-lxml``.
Something went wrong with that request. Please try again.