Cannot open include file: 'libxml/xpath.h': No such file or directory

Posted 大斗神204

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Cannot open include file: 'libxml/xpath.h': No such file or directory相关的知识,希望对你有一定的参考价值。

在搭建scrapy爬虫框架时,通过pip安装lxml遇到了这个问题,我是用32位的windows搭建爬虫框架,python版本是2.7.12, 解决方案如下:

  原因:  

  在网上各种找原因,有大神是说没安装libxml2-devel and libxslt-devel,和没有安装 libxml2和 libxslt文件。其实报错原因中也说明了没有安装好 libxml2

  各种解决方案,但是找了很久,试了很多种方法,最终我就参考了

    http://coding.derkeiler.com/Archive/Python/comp.lang.python/2012-11/msg00520.html       

    http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml(很多python依赖的库资源下载)

    http://jingyan.baidu.com/article/cbcede07177b8702f40b4df9.html

在windows操作系统下:

    1、安装wheel,在cmd中输入:pip install wheel

    2、下载依赖库,可以在http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml中下载 

      lxml-3.6.4-cp27-cp27m-win32.whl(python2.7版本,适用于windows32位系统)

      lxml-3.6.4-cp27-cp27m-win_amd64.whl(python2.7版本,适用于windows64位系统

      然后,把下载好的依赖文件放在python的安装包中,我的是放在F:\python2.7.12中

    3、开始安装lxml

        pip install F:\python2.7.12\lxml-3.6.4-cp27-cp27m-win32.whl

以上是关于Cannot open include file: 'libxml/xpath.h': No such file or directory的主要内容,如果未能解决你的问题,请参考以下文章

Cannot open include file: 'stdlibe.h': No such file or directory

Cannot open include file: 'initializer_list': No such file or directory

Cannot open include file: 'libxml/xpath.h': No such file or directory

用vc++6.0编译时Cannot open include file: 'stdio.h'这是啥地方不对

Cannot open include file: 'windows.h': No such file or directory 用的是VC++6.0

python2安装Flask-MySQLdb出现 fatal error C1083: Cannot open include file: 'mysql.h': No su ch fi