linux python3 安装lxml失败

pip3 install lxml

一系列报错

........................

 *********************************************************************************
  Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
  *********************************************************************************
  error: command 'i686-linux-gnu-gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for lxml
  Running setup.py clean for lxml
Failed to build lxml

............. cc -I/usr/include/libxml2 -c /tmp/xmlXPathInitmro9i7ra.c -o tmp/xmlXPathInitmro9i7ra.o
    /tmp/xmlXPathInitmro9i7ra.c:1:26: fatal error: libxml/xpath.h: 没有那个文件或目录

compilation terminated.

 *********************************************************************************
    Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
    *********************************************************************************
    error: command 'i686-linux-gnu-gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-0n_gaind/lxml/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-tofumekn-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-0n_gaind/lxml/



运行下面三个, 可能packages 会有些不一样,建议tab补全

sudo apt-get install libxml2-dev
sudo apt-get install libxslt1-dev
sudo apt-get install python3-dev



你可能感兴趣的:(python)