第一次安装,使用pip安装:pip install scrapy
成功安装
第一次创建框架:scrapy startproject renting
项目创建成功:

第一次尝试运行项目报错:scrapy crawl 爬虫名
这个地方出现的错误比较多常见:1、scrapy无法引用;
2、注释提示错误;
3、iterms模块无法引用
其实错误的地方在安装时我们采用的mac默认的pip版本,默认pip版本时与python2.7关联的:
New Scrapy project 'renting', using template directory '/usr/local/lib/python2.7/site-packages/scrapy/templates/project', created in:
注意:这里默认的是python2.7版本,而我们安装的scrapy是最新版本,指定是不兼容的
追根求源,其实这个还是我们mac电脑上python2,3共存的情况导致的。
推荐解决办法:使用pip3 安装scrapy
1、使用pip3安装scrapy:pip3 install scrapy
成功提示:

2、尝试创建爬虫框架,这时候报错了:

推荐解决方法,建立/usr/local/bin/scrapy的软链接,创建方法:
sudo ln -s 愿目录 指向目录
sudo ln -s /Library/Frameworks/Python.framework/Versions/3.6/bin/scrapy /usr/local/bin/scrapy
尝试输入:scrapy

3、尝试创建项目:scrapy startproject renting

4、查看目录:tree 【mac安装tree命令方法:brew install tree】

5、尝试运行爬虫 进入框架: cd renting 运行命令:scrapy crawl dx

显示dx爬虫不存在【因为我是随便起的】,依赖python版本为3.6表示框架已经安装成功了
未完,等待大坑出现
网友评论