mac pip install lxml

报错如下:

cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -Wno-error=unused-command-line-argument-hard-error-in-future -pipe -Wno-error=unused-command-line-argument-hard-error-in-future -I/usr/include/libxml2 -I/private/tmp/pip_build_root/lxml/src/lxml/includes -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.macosx-10.10-intel-2.7/src/lxml/lxml.etree.o -w -flat_namespace

 

In file included from src/lxml/lxml.etree.c:239:

 

/private/tmp/pip_build_root/lxml/src/lxml/includes/etree_defs.h:14:10: fatal error: 'libxml/xmlversion.h' file not found

 

#include "libxml/xmlversion.h"

 

         ^

 

1 error generated.

 

error: command 'cc' failed with exit status 1

 

 

 

------------------------------

首先确认使用了 brew 安装 install libxml2 and libxslt

 

 

执行以下命令:

xcode-select --install
sudo CPATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2 CFLAGS=-Qunused-arguments CPPFLAGS=-Qunused-arguments pip install lxml
我的Mac为 MacOSX10.10.sdk 





猜你喜欢

转载自hyl198611.iteye.com/blog/2160672