mac安装scrapy

Mac自带python2.7,所以直接安装scrapy。默认安装了Xcode
总共分以下几步:
1.安装 homebrew、wget
2.安装pip
3.安装scrapy

安装homebrew
在terminal输入/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
第一次安装后,发现brew命令不能用,原因不明。尝试了很多解决办法之后,发现一个有用的方法。
首先删除之前的安装/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
然后重新安装一下
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
安装wget
brew install wget

安装pip
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
安装了pip之后,一定要修改pip源,因为可能会被墙。
在HOME下mkdir .pip然后touch pip.conf,HOME目录是哪里,和vimrc一个目录的地方,cat ~/.vimrc, cat ~/.pip/pip.conf此处
在pip.conf键入:
[global]
index-url = http://pypi.mirrors.ustc.edu.cn/simple 保存
这里的http://pypi.mirrors.ustc.edu.cn是中科大的pipi镜像

上述index-url是国内源,除了这个还有以下几个:

阿里云http://mirrors.aliyun.com/pypi/simple/

中科科学技术大学http://pypi.mirrors.ustc.edu.cn/simple/

豆瓣 http://pypi.douban.com/simple/ 

清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/

 安装commend line tools

xcode-select --install

最后安装scrapy
sudo pip install Scrapy
安装之后,输入scrapy命令发现commend not found
原因是Mac自带的python与pip不对应,所以重装了自己的python 如下
   sudo rm -rf /usr/bin/python
   sudo ln -s /usr/local/bin/python /usr/bin/python
   pip install scrapy
结束。

原文地址:https://www.cnblogs.com/kumufengchun/p/10955612.html