Mac OS下安装 lxml报错

曹超
2023-12-01
今天在Mac下安装lxml总是报错,错误信息如下:

n file included from src/lxml/lxml.etree.c:346:

/tmp/easy_install-UkLnaO/lxml-3.3.5/src/lxml/includes/etree_defs.h:9:10: fatal error: 

      'libxml/xmlversion.h' file not found

解决办法:

sudo C_INCLUDE_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/libxml2:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/libxml2/libxml:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include easy_install lxml


把整段代码复制下来就可以了。我用的是easy_install安装的,也可以使用pip安装,都可以。
 类似资料: