无法在我的Mac上安装Scrapy

Jef*_*Lee 1 python macos pip scrapy

我目前正在使用Mac OS X 10.11.1 El Capitan.我在我的mac上安装了python 2.7和3.5.我也安装了pip.但是,我总是无法在我的Mac上安装scrapy.

我用了

$sudo pip install scrapy
Run Code Online (Sandbox Code Playgroud)

它总是发现错误.(像这样)

 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
Run Code Online (Sandbox Code Playgroud)

还有这个..

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
Run Code Online (Sandbox Code Playgroud)

谁能告诉我问题和解决方案是什么?

dat*_*ful 10

xcode-select --install
Run Code Online (Sandbox Code Playgroud)

自升级以来,您可能还没有更新代码命令行工具.