1.安装pip
安装pip时,很简单,在mac上,只需按照官网上面的步骤一步一步来就可以成功;按照官网https://pip.pypa.io/en/latest/installing.html介绍,首先下载get-pip.py这个文件,下载地址为:https://bootstrap.pypa.io/get-pip.py,然后执行如下命令即可:
python get-pip.py
2.安装Scrapy
只需以root身份执行
sudo pip install scrapy
中间可能遇到报错部分:
1:pip install 遇到"operation is not permitted"
creating /System/Library/Frameworks/Python.framework/Versions/2.7/share error: could not create '/System/Library/Frameworks/Python.framework/Versions/2.7/share': Operation not permitted
解决办法:
先安装XCODE的command-line tool:
xcode-select --install
再者重新安装Python:
sudo brew reinstall python
最后重新安装Scrapy:
sudo pip install scrapy
2:pip install Bad md5 hash for ...
Hash of the package https://pypi.python.org/packages/source/u/uWSGI/uwsgi-2.0.11.1.tar.gz#md5=087ba7b53bd4afc0f0218f5eb3398809 (from https://pypi.python.org/simple/uwsgi/) (d4482033ec732ac3ef5f3e29ca607a42) doesn't match the expected hash 087ba7b53bd4afc0f0218f5eb3398809! Bad md5 hash for package https://pypi.python.org/packages/source/u/uWSGI/uwsgi-2.0.11.1.tar.gz#md5=087ba7b53bd4afc0f0218f5eb3398809 (from https://pypi.python.org/simple/uwsgi/)
解决办法:
删除 Pip cache
rm -rf ~/.pip/cache/
sudo rm -rf /root/.pip/cache
或者运行 pip 不使用 cache:
sudo pip install --no-cache-dir scrapy
参考:
Brew安装命令参考:
curl -LsSf http://github.com/mxcl/homebrew/tarball/master | sudo tar xvz -C/usr/local --strip 1
参考链接:http://snowolf.iteye.com/blog/774312
http://www.lzqwebsoft.net/show/20140613014220.html
http://stackoverflow.com/questions/32898583/unable-to-install-nltk-on-mac-os-el-capitan
http://segmentfault.com/q/1010000003048616
文章的脚注信息由WordPress的wp-posturl插件自动生成