In file included from src/lxml/lxml.etree.c:323:
    src/lxml/includes/etree_defs.h:14:10: fatal error: 'libxml/xmlversion.h' file not found
    #include "libxml/xmlversion.h"
    1 error generated.
    Compile failed: command 'clang' failed with exit status 1
    cc -I/usr/include/libxml2 -I/usr/include/libxml2 -c /tmp/xmlXPathInitBMovjd.c -o tmp/xmlXPathInitBMovjd.o
    /tmp/xmlXPathInitBMovjd.c:1:10: fatal error: 'libxml/xpath.h' file not found
    #include "libxml/xpath.h"
    1 error generated.

二、解决之道

使用命令来设置编译的包含头文件

sudo C_INCLUDE_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2/libxml:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MaOSX10.11.sdk/usr/include pip install lxml
Mac 终端执行 pip install lxml 报错:(env) zhude Mac Book-Air:the19 zhu$ pip install lxml Collecting lxml Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectio 安装 完caffe,在caffe/build中执行make pycaffe时,报出以下错误: linxierdeAir:caffe linxier$ cd build linxierdeAir:build linxier$ make pycaffe [ 1%] Built target caffeproto [ 98%] Built target caffe [ 98%] Building CX... I am trying to build a shared library using a C extension file but first I have to generate the out 解决使用 pip 安装 lxml 包报错问题 基于Ubuntu15.10,其他发行版未测试过是否有效。如果懒得看前面的排查过程的话可以直接使用最后那个命令。 今天想要试试beautifulsoup4, 安装 的时候很顺利,然后就准备 安装 lxml 作为解析器,没想到 安装 pip 直接给我报了一整页的错误。 可以在官方链接中下载,64位下载amd64,cp39代表你的Python版本 下载后更改后缀名.whl为.zip,并解压 将解压得到的文件拷贝到找到对应版本Python文件夹的Lib目录下即可 或者采用代码在Pycharm下方的Terminal中输入 pip install lxml # 安装 最新版本 pip install lxml ==版本号 # 安装 对应版本