python安装scrapy爬虫框架,提示 error: command 'clang' failed with exit status 1

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/songrenqing/article/details/80555419

scrapy是python爬虫中,比较常用的一种框架。

提示异常:

Mac上安装的时候,报错"error: command 'clang' failed with exit status 1"。

songrenqingdeMacBook-Pro:~ songrenqing$ pip install scrapy
Collecting scrapy
  Using cached https://files.pythonhosted.org/packages/db/9c/cb15b2dc6003a805afd21b9b396e0e965800765b51da72fe17cf340b9be2/Scrapy-1.5.0-py2.py3-none-any.whl
...
    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
    error: command 'clang' failed with exit status 1

异常原因:

Mac的OSX系统的C语言,编译器用的是Clang。既然报错与clang有关,应该是xcode command tools出现问题,网上搜了一下其它文章,大部分人也都是通过更新安装xcode解决的。

songrenqingdeMacBook-Pro:~ songrenqing$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.1.0 (clang-902.0.39.2)

解决办法:

执行 xcode-select --install 命令后,重新安装 

songrenqingdeMacBook-Pro:~ songrenqing$ xcode-select --install
xcode-select: note: install requested for command line developer tools
songrenqingdeMacBook-Pro:~ songrenqing$ pip install scrapy
......
Successfully installed Twisted-18.4.0 scrapy-1.5.0
展开阅读全文

没有更多推荐了,返回首页