pip install lxml

前沿:

时间:2020 

问题 安装lxml后无法使用

为什么?

使用软件

  1. Windows10
  2. pycharm 2019.3

 一:pip install lxml

这个直接就可以安装成功;

安装成功后一定要确认lxml 在Pycharm 下,复制文件lxml到这里

 

运行时如果出现:

 c:\users\f\appdata\local\temp\xmlXPathInitqjzysz.c(1) : fatal error C1083: Cannot open include file: 'libxml/xpath.h': No such file or directory
  *********************************************************************************
  Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
  *********************************************************************************
  error: command 'C:\\Users\\f\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2

如果还提示 需要安装C++库

也需要安装:

如果安装不成功可以试试下面:

Lxml是基于libxml2这一XML解析库构建的python库,它使用C语言编写,解析速度比Beautiful Soup更快,在windows下安装相对比较复杂。下面是在win10上面安装lxml的步骤。

在windows下,是无法通过pip成功按照lxml的,需要借助.whl文件进行安装。

1.安装wheel库:

pip install wheel

2.下载lxml的.whl文件

3.用pip命令安装下载好的.whl文件。shit +

pip install XXXXXX.whl

4.如果第三步出现如下所示的错误,导致whl文件安装失败,则可能是两种原因导致的:

lxml-4.3.2-cp27-cp27m-win_amd64.whl is not a supported wheel on this platform. 

一、pip的版本太旧。可以尝试更新pip。

二、下载的whl版本不对。lxml的文件中,cp27表示的是python的版本号,要与你的python版本号一致。

5.更新pip的命令如下:

python -m pip install --upgrade pip

当安

猜你喜欢

转载自www.cnblogs.com/WLCYSYS/p/12892405.html