Installing lxml on 10.9

Installing the Python lxml module (3.2.5) on 10.9.1(13B42) seems to fail with the following error:

In file included from src/lxml/lxml.etree.c:314:

/Users/filipp/myenv/build/lxml/src/lxml/includes/etree_defs.h:9:10: fatal error: 'libxml/xmlversion.h' file not found

#include "libxml/xmlversion.h"

^

1 error generated.

error: command '/usr/bin/clang' failed with exit status 1

That's because 10.9 doesn't come with libxml, but rather libxml2. Luckily the latter also includes the headers for libxml under

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2/libxml

So we can easily solve the problem by modifying our pip command:

$ CPATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2 pip install -U lxml