不灭的焱

革命尚未成功,同志仍须努力下载JDK17

作者:Albert.Wen  添加时间:2020-11-20 17:38:53  修改时间:2024-03-11 18:36:13  分类:Java基础  编辑

在安装某个Python开源系统的依赖库时,突然报一下错误:

make sure the development packages of libxml2 and libxslt are installed

问题分析:

pip方式安装lxml失败,得改用安装对应的.whl文件。

 解决方案:

http://www.lfd.uci.edu/~gohlk... 下载whl安装包,

文件名为:lxml-4.5.2-cp38-cp38-win_amd64.whl

  • cp38表示 Python3.8

  • win32表示Python的位数,注意:不是操作系统的位数,不知道可以在cmd里输入python

  • D:\456>python
    Python 3.8.5 (default, Sep  3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
    
    Warning:
    This Python interpreter is in a conda environment, but the environment has
    not been activated.  Libraries may fail to load.  To activate this environment
    please see https://conda.io/activation
    
    Type "help", "copyright", "credits" or "license" for more information.
    >>>

    显示的是 64位

下载后使用pip安装

pip install wheel   #如果没有安装过wheel就安装以下
pip install ./lxml-4.5.2-cp38-cp38-win_amd64.whl  #在whl文件目录中执行

 

 

参考:https://segmentfault.com/q/1010000007324956

 


【后续补充】

按照如下方式,其实是可以正常安装 lxml

pip install lxml

只是系统(requirements.txt文件)里面强制指定了某个低版本的 lxml,导致当前的Python3.8对它安装失败

lxml==4.3.0

把这个版本号限制去掉,自动安装最新版本的lxml,一切正常!