Note:
This is my first post on this list. There was an absence of windows binaries for lxml on the net (all the sites that had older versions were down). Unfortunately, there wasn't enough information to make the process of building on windows easy. I wrote this guide to solve both these problems. I hope that the information here can at worst help out others trying to build on windows and at best get included in the documentation and maintenance.
I also have a windows installer created for lxml 0.9.1 that is staticly built with iconv-1.9.1, libxml2 2.6.23, libxslt 1.1.15, and zlib 1.2.3. If there is some ftp site or something I can upload it to, in order to give wide access to it, please let me know what to do.
David Sankel
Building lxml on windows
===================
First you'll need to download the latest version of all the required files. Download them all to the same directory.
* libxml: Availible from
http://codespeak.net/lxml/
* iconv, libxml2, libxslt, and zlib are all availible from xmlsoft.org. The place to go on the ftp site is
ftp://xmlsoft.org/libxml2/win32.
Your directory should now have something like the following files in it:
iconv-1.9.1.win32.zip
libxml2-2.6.23.win32.zip
libxslt-1.1.15.win32.zip
lxml-0.9.1.tgz
zlib-1.2.3.win32.zip
Now extract each of those files in the _same_ directory. Now you should have something like this:
iconv-1.9.1.win32/
iconv-1.9.1.win32.zip
libxml2-2.6.23.win32/
libxml2-2.6.23.win32.zip
libxslt-1.1.15.win32/
libxslt-1.1.15.win32.zip
lxml-0.9.1/
lxml-0.9.1.tgz
zlib-1.2.3.win32/
zlib-1.2.3.win32.zip
Go to the lxml-0.9.1 directory and edit the Makefile. There should be a section that looks like this::
ext_modules = [ Extension(
"lxml.etree",
sources = sources,
extra_compile_args = ['-w'] + flags('xslt-config --cflags'),
extra_link_args = flags('xslt-config --libs')
)],
Change it to this (Warning: make sure you are using version numbers that correspond to your downloads) (Note: the _a portion of the libraries means that we are statically linking. If you want to use dlls(why?), link to the dll version of the libraries)::
ext_modules = [ Extension(
"lxml.etree",
sources = sources,
extra_compile_args = [
"-w",
"-I..\\libxml2-2.6.23.win32\\include
",
"-I..\\libxslt-1.1.15.win32\\include",
"-I..\\zlib-1.2.3.win32\\include",
"-I..\\iconv-1.9.1.win32\\include"
],
extra_link_args = [
"..\\libxml2-2.6.23.win32\\lib\\libxml2_a.lib",
"..\\libxslt-1.1.15.win32\\lib\\libxslt_a.lib",
"..\\zlib-1.2.3.win32\\lib\\zlib.lib",
"..\\iconv-
1.9.1.win32\\lib\\iconv_a.lib"
]
)],
Now you should be able to use setup.py and everything should work well. "python setup.py bdist_wininst" will create a windows installer in the pkg directory.