mac安装scrapy并创建项目的实例讲解
作者:蜡笔小心丶 时间:2021-05-17 21:21:05
最近刚好在学习python+scrapy的爬虫技术,因为mac是自带python2.7的,所以安装3.5版本有两种方法,一种是升级,一种是额外安装3.5版本。
升级就不用说了,讲讲额外安装的版本吧~~~
因为python是有自带版本的,最开始安装的时候都会有一种“ 会不会冲突 ”的感觉。
其实安装3.5版本也就是在官网上直接下载之后安装,和普通的mac软件安装方式是一样的~~
https://www.python.org/downloads/release/python-353/
安装完成之后,不会覆盖原来的python,会在 /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5文件中
在终端直接输入 python 会执行python2.7版本
python
Python 2.7.12 (default, Jun 29 2016, 14:05:02)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
在终端直接输入 python3 则会执行python3.5版本
python3
Python 3.5.3 (v3.5.3:1880cb95a742, Jan 16 2017, 08:49:46)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
接下来就可以开始安装scrapy了
python3.5中会自带 pip,所以不需要额外安装了,可以直接在终端输入 pip3 --version查看版本和路径
pip3 --version
pip 9.0.1 from /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (python 3.5)
使用 pip3 安装scrapy
pip3 install Scrapy
这里的Scrapy一定要首字母大写,不然会在安装的过程中报错~~
Collecting scrapy
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x103aa2c88>: Failed to establish a new connection: [Errno 61] Connection refused',)': /simple/scrapy/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x103aa29e8>: Failed to establish a new connection: [Errno 61] Connection refused',)': /simple/scrapy/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x103aa2630>: Failed to establish a new connection: [Errno 61] Connection refused',)': /simple/scrapy/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x103aa2f28>: Failed to establish a new connection: [Errno 61] Connection refused',)': /simple/scrapy/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x103aa2be0>: Failed to establish a new connection: [Errno 61] Connection refused',)': /simple/scrapy/
Could not find a version that satisfies the requirement scrapy (from versions: )
No matching distribution found for scrapy
安装成功之后,可以直接在终端上输入 scrapy 查看版本号及使用
Scrapy 1.4.0 - no active project
Usage:
scrapy <command> [options] [args]
Available commands:
bench Run quick benchmark test
fetch Fetch a URL using the Scrapy downloader
genspider Generate new spider using pre-defined templates
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
在pycharm中是没有直接创建scrapy项目的,可以使用 scrapy 命令手动新建项目
scrapy startproject ArticleSpider(ArticleSpider为项目名称)
来源:https://blog.csdn.net/u011615787/article/details/72628920
标签:mac,安装,scrapy
0
投稿
猜你喜欢
前女友发来加密的"520快乐.pdf",我用python破解开之后,却发现
2023-07-17 20:33:16
无级分类的多级联动
2020-07-02 12:53:12
MySQL普通表如何转换成分区表
2024-01-15 00:30:43
python使用jieba实现中文分词去停用词方法示例
2021-02-04 11:27:17
asp日期转换成汉字格式程序
2008-07-08 18:19:00
python数据写入Excel文件中的实现步骤
2023-11-19 23:11:45
Java timezone设置和mybatis连接数据库时区设置方式
2024-01-24 09:43:18
Python 编程速成(推荐)
2021-04-03 04:30:10
浏览器的字体等宽空格
2008-08-28 12:25:00
网页模式化窗口
2008-04-27 20:52:00
将mater库中的系统存储过程批量生成*.sql文件 通用且非常实用
2012-06-06 20:03:43
php实现的美国50个州选择列表实例
2023-11-17 11:06:06
python实现的系统实用log类实例
2022-08-02 18:50:57
教你设计大型Oracle数据库
2024-01-28 06:51:36
openstack中的rpc远程调用的方法
2022-09-23 03:45:17
Python实现字典的key和values的交换
2021-08-18 03:45:49
Python实现迭代时使用索引的方法示例
2022-12-15 11:08:48
简述php环境搭建与配置
2023-11-15 09:08:28
使用Python和百度语音识别生成视频字幕的实现
2022-02-28 23:12:42
如何基于Python制作有道翻译小工具
2023-10-01 21:00:58