python中如何安装libxml2

按习惯使用pip install libxml2安装失败:
在这里插入图片描述
提示找不到叫 libxml2 的插件版本

ubuntu@VM-0-17-ubuntu:/usr/bin$ sudo pip install libxml2
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
WARNING: The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Looking in indexes: http://mirrors.tencentyun.com/pypi/simple
ERROR: Could not find a version that satisfies the requirement libxml2 (from versions: none)
ERROR: No matching distribution found for libxml2

stackoverflow上找到的答案是:要这样安装:

sudo apt-get install libxml2-dev libxslt-dev python-dev

pip install lxml

https://stackoverflow.com/questions/38148460/pip-install-libxml2-failed

但为什么 pip install 的是 lxml 不是 libxml2?

还是找找官网:
在这里插入图片描述

在这里插入图片描述
官网第一句话即说明了:在python中libxml2叫lxml。
所以要用:pip install lxml 安装

官网地址:
http://xmlsoft.org/index.html
https://lxml.de/

  • 3
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值