您的位置:首页 > 其它

mac os用pip安装scrapy时报错#include "libxml/xmlversion.h" file not found

2015-08-12 15:02 537 查看
安装一个python爬虫框架scrapy,pip安装时总是报如下错误:
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


试了几次仍然不行,用作为'libxml/xmlversion.h'
file not found关键词搜索

很快就找到来答案,记录一下。

C_INCLUDE_PATH要指定到XCode MacOSX SDK中libxml路径,一开始只看到:

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

后来发现还要打上sudo和pip install才行

sudo C_INCLUDE_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/libxml2:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/libxml2/libxml:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include pip install scrapy
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: