【Python爬虫】安装 pyQuery 遇到的坑 Could not find function xmlCheckVersion in library libxml2. Is libxml2 ins...

windows 64位操作系统下,用 Python 抓取网页,并用 pyQuery 解析网页

pyQuery是jQuery在python中的实现,能够以jQuery的语法来操作解析HTML文档,十分方便。使用前需要安装,easy_install pyquery即可,或者Ubuntu下
详情参考:
http://blog.csdn.net/zhaoyl03/article/details/8631645

但是用pip命令安装pyquey的时候,报错了

pip install pyquery

提示需要先安装 lxml ,于是用如下命令安装 lxml

pip install lxml

 报错

Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?

查资料,知乎上找到如下解决方案:https://www.zhihu.com/question/30047496 亲测有效。

1. 安装wheel,命令行运行:
pip install wheel
2.在这里下载对应的.whl文件,注意别改文件名! http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml
3. 进入.whl所在的文件夹,执行命令即可完成安装
pip install 带后缀的完整文件名

从上面的地址下载到适合我电脑的whl文件:lxml-3.6.4-cp27-cp27m-win_amd64.whl

然后在安装 pyquery,成功搞定!

C:\Python27\Scripts>pip install lxml-3.6.4-cp27-cp27m-win_amd64.whl
Processing c:\python27\scripts\lxml-3.6.4-cp27-cp27m-win_amd64.whl
Installing collected packages: lxml
Successfully installed lxml-3.6.4

C:\Python27\Scripts>pip install pyquery
Collecting pyquery
  Using cached pyquery-1.2.17-py2.py3-none-any.whl
Requirement already satisfied: lxml>=2.1 in c:\python27\lib\site-packages (from
pyquery)
Requirement already satisfied: cssselect>0.7.9 in c:\python27\lib\site-packages
(from pyquery)
Installing collected packages: pyquery
Successfully installed pyquery-1.2.17

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值