How to install lxml for Python 3.4.3 on Windows

The XML is widely used in various places, its quite common for a Python programmer need to deal with XML document, there are many tools available out there. For example the lxml, lxml is a Pythonic binding for the C libraries libxml2 and libxslt which quite easy to use.

Install lxml on Linux is a breeze. But not so for Windows users.

If you don't want to install it from the source code which will need you already installed Visual Studio and C++ compiler, you need to install it from wheel file or precompiled binary.

You can get them from the following places:

 
https://pypi.python.org/pypi/lxml/3.4.0#downloads
http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml
 

And then install with the command

 
python -m pip install lxml-3.4.0-cp26-none-win32.whl
 

Before downloading you should check your Python platform and version.

 
python --version
 
C:\tmp>python
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import distutils.util;
>>> print(distutils.util.get_platform())
win32
>>>
 
 

You may get error

 
[31mlxml-3.4.0-cp26-none-win32.whl is not a supported wheel on this platform.
 

But I think the simplest way is to download the installer exe file and click to install. For example the lxml-3.4.0.win32-py3.4.exe (md5), it works for me.

Start parsing XML with Python and lxml:How to parse XML with Python and lxml.