我目前使用的是 Mac OS X 10.11.1 El Capitan。我在我的 mac 上同时安装了 python 2.7 和 3.5。我也安装了 pip。但是,我总是无法在我的 mac 上安装 scrapy。
我用过
$sudo pip install scrapy
它总是发现错误。 (像这样)
1 error generated.
Compile failed: command 'cc' failed with exit status 1
creating tmp
cc -I/usr/include/libxml2 -I/usr/include/libxml2 -c /tmp/xmlXPathInitOS_E4M.c -o tmp/xmlXPathInitOS_E4M.o
/tmp/xmlXPathInitOS_E4M.c:1:10: fatal error: 'libxml/xpath.h' file not found
#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
还有这个..
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-veAN2s/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-8tLCDw-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-veAN2s/lxml
谁能告诉我问题是什么以及解决方案是什么?
请您参考如下方法:
xcode-select --install
升级后您可能还没有更新代码命令行工具。
