解决lxml在mavericks下安装失败的问题

lxml在Mac OS X Mar 上试用pip install安装会提示错误:

lxml/src/lxml/includes/etree_defs.h:9:10: fatal error: ’libxml/xmlversion.h’ file not found

#include “libxml/xmlversion.h”

^

1 error generated. 原因是无法找到libxml2对应的头文件,这需要添加对应的头文件搜索路径,只需要安装前执行:

export C_INCLUDE_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/libxml2:$C_INCLUDE_PATH

即可。

Licensed under CC BY-NC-SA 4.0
comments powered by Disqus