解决libxml/xmlversion.h: No such file or directory

报错如下:

1
2
3
4
5
/tmp/pip-build-imUeln/lxml/src/lxml/includes/etree_defs.h:14:31: fatal error: libxml/xmlversion.h: No such file or directory
#include "libxml/xmlversion.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1

解决:

1
export C_INCLUDE_PATH=/usr/include/libxml2/

仍发生错误:

1
ERROR: /bin/sh: xslt-config: command not found

解决:

1
yum install libxslt-devel

再安装lxml 或 scrapy 成功。