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
相關文章
相關標籤/搜索