最近在学习Python的时候,安装lxml总是失败
#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 1
安装libxml2后还是提示这样的错误,终于在费劲周折之后找到了问题所在
需要增加C_INCLUDE_PATH指定到Xcode MacOs sdks中的libxml2路径才可以。
sudo C_INCLUDE_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2/
然后在执行sudo pip install lxml就OK了