python3 安装lxml 大坑

用bs4 解析xml的时候发现有lxml包的依赖,安装lxml一直不成功:

这个地址http://lxml.de/installation.html ,官方安装说明,

You need Python 2.6 or later.

libxml2 version 2.7.0 or later.

libxslt version 1.1.23 or later.

在linux下安装的过程跳过,可以参考文档说明

在windows下,建议是直接使用二进制文件安装。

unofficial Windows binaries:http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml

随便下了一个,在pip install *whl 失败!提示说平台不支持,又蒙了

[plain]  view plain  copy
  1. is not a supported wheel on this platform  

原来,lxml-3.4.4-cp34-none-win32.whl ,cp34对应不同的Python版本支持,需要查看自己的Python版本支持情况:

[python]  view plain  copy
  1. import pip; print(pip.pep425tags.get_supported())  

[python]  view plain  copy
  1. Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 201522:43:06) [MSC v.1600 32 bit (In  
  2. Type "help""copyright""credits" or "license" for more information.  
  3. >>> import pip; print(pip.pep425tags.get_supported())  
  4. [('cp34''none''win32'), ('py3''none''win32'), ('cp34''none''any'), (  
  5. e', 'any'), ('cp32', 'none', 'any'), ('cp31', 'none', 'any'), ('cp30', 'none', '  
  6. 3', 'none', 'any'), ('py33', 'none', 'any'), ('py32', 'none', 'any'), ('py31', '  
  7. ')]  

显然,用cp34-none-win32才可以

[python]  view plain  copy
  1. pip install lxml-3.4.4-cp34-none-win32.whl  

windows环境下成功安装lxml。

[python]  view plain  copy
  1. Processing d:\order\lxml-3.4.4-cp34-none-win32.whl  
  2. Installing collected packages: lxml  
  3. Successfully installed lxml-3.4.4  

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值