mac上 python 安装lxml失败Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed

 

安装lxml时失败xcode

#include "libxml/xpath.h"
             ^
    1 error generated.
    *********************************************************************************
    Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
    Perhaps try: xcode-select --install
    *********************************************************************************
    error: command 'cc' failed with exit status 1app

 

安装libxml2后仍是提示这样的错误,终于在费劲周折以后找到了问题所在spa

须要增长C_INCLUDE_PATH指定到Xcode MacOs sdks中的libxml2路径才能够。code

sudo C_INCLUDE_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2/orm

 

而后在执行xml

xcode-select --install
pip install lxml
相关文章
相关标签/搜索