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

转载于:https://www.cnblogs.com/caochuangui/p/5980469.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
回答: 当你在Ubuntu系统中运行某些软件时,可能会遇到"libxml2.so.2: cannot open shared object file: No such file or directory"的错误。这个错误是由于缺少libxml2.so.2库文件导致的。要解决这个问题,你可以按照以下步骤操作: 1. 确认你的系统中是否已经安装了libxml2库。可以通过运行以下命令进行检查: ``` dpkg -l | grep libxml2 ``` 如果没有结果,说明还没有安装该库。 2. 如果没有安装libxml2库,你可以通过运行以下命令来安装: ``` sudo apt-get install libxml2 ``` 3. 安装完成后,重新运行你的软件,看是否还会出现错误。 如果以上方法都没有解决问题,你可以尝试在网上搜索更详细的解决方案,例如引用中提供的链接。123 #### 引用[.reference_title] - *1* [error while loading shared libraries: libxml2.so.2: cannot open shared object file: No such fil](https://blog.csdn.net/u012022920/article/details/20362083)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item] - *2* *3* [error while loading shared libraries: libxml2.so.2: cannot open shared object file 解决方法](https://blog.csdn.net/qq_39779233/article/details/128215517)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值