Python爬虫实战入门一:工具准备
一、基础知识
使用Python编写爬虫,当然至少得了解Python基本的语法,了解:
基本数据结构
数据类型
控制流
函数的使用
模块的使用
不需要过多过深的Python知识,仅此而已。
操作系统:Windows 7
Python版本:Python 3.4
代码编辑运行环境:个人推荐PyCharm社区版,当然,Python自带的IDLE也行,Notepad++亦可,只要自己使用得习惯。
requests:一个方便、简洁、高效且人性化的HTTP请求库
BeautifulSoup:HTML解析库
pymongo:MongoDB的Python封装模块
selenium:一个Web自动化测试框架,用于模拟登录和获取JS动态数据
pytesseract:一个OCR识别模块,用于验证码识别
Pillow:Python图像处理模块
上面列出的第三方模块大多可以通过pip install ××的方式直接安装,部分模块安装方式不一样,下面一一演示:
requests
pip install requests

BeautifulSoup
pip install bs4

pymongo
pip install pymongo

selenium
pip install selenium

Pillow
1、打开http://www.lfd.uci.edu/~gohlke/pythonlibs/
2、搜索找到“pillow”
3、根据自己系统的版本选择对应的下载包

4、安装
pip install Pillow‑4.0.0‑cp34‑cp34m‑win32.whl

pytesseract
1、pip install pytesseract

2、安装tesseract
这样,我们的准备工作就基本完成,如果有另外的需求,在实战中再进行安装,接下来就可以实战Python爬虫了。
在学习中有迷茫不知如何学习的朋友小编推荐一个学Python的学习裙[227435450]无论你是大牛还是小白,是想转行还是想入行都可以来了解一起进步一起学习!裙内有开发工具,很多干货和技术资料分享!