logo头像

小玉的技术博客

Python高级编程之爬虫Scrapy框架安装配置

Mac下安装Scrapy框架

刚刚试了下可以,可以简化为下面三个步骤
一、删除Mac自带的Python
sudo rm -rf /usr/bin/python
二、homebrew安装最新的Python
brew install python
创建一个软链接
sudo ln -s /usr/local/bin/python /usr/bin/python
三、使用pip安装scrapy
使用homebrew安装完python后会自动安装好包管理工具pip,所以执行下面安装命令
pip install scrapy
安装完成后如下所示

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
machaismile$ scrapy
Scrapy 0.22.2 - no active project
Usage:
scrapy <command> [options] [args]
Available commands:
bench Run quick benchmark test
fetch Fetch a URL using the Scrapy downloader
runspider Run a self-contained spider (without creating a project)
settings Get settings values
shell Interactive scraping console
startproject Create new project
version Print Scrapy version
view Open URL in browser, as seen by Scrapy
[ more ] More commands available when run from project directory
Use "scrapy <command> -h" to see more info about a command

出现 zsh: command not found: scrapy 执行

ln -s /Library/Frameworks/Python.framework/Versions/2.7/bin/scrapy /usr/local/bin/scrapy

支付宝打赏 微信打赏

赞赏是不耍流氓的鼓励