Python爬虫实战入门一:工具准备

一、基础知识

使用Python编写爬虫,当然至少得了解Python基本的语法,了解:

基本数据结构

数据类型

控制流

函数的使用

模块的使用

不需要过多过深的Python知识,仅此而已。

个人推荐《Python简明教程》http://www.kuqin.com/abyteofpython_cn/、Python官方的《Python教程》http://python.usyiyi.cn/translate/python_352/tutorial/index.html


二、开发环境、

操作系统: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

Python爬虫实战入门一:工具准备_第1张图片

pymongo

pip install pymongo

Python爬虫实战入门一:工具准备_第2张图片

selenium

pip install selenium

Python爬虫实战入门一:工具准备_第3张图片

Pillow

1、打开http://www.lfd.uci.edu/~gohlke/pythonlibs/

2、搜索找到“pillow”

3、根据自己系统的版本选择对应的下载包

Python爬虫实战入门一:工具准备_第4张图片

4、安装

pip install Pillow‑4.0.0‑cp34‑cp34m‑win32.whl

Python爬虫实战入门一:工具准备_第5张图片

pytesseract

1、pip install pytesseract

2、安装tesseract

下载并安装:https://tesseract-ocr.googlecode.com/files/tesseract-ocr-setup-3.02.02.exe

这样,我们的准备工作就基本完成,如果有另外的需求,在实战中再进行安装,接下来就可以实战Python爬虫了。

你可能感兴趣的:(Python爬虫实战入门一:工具准备)