0.以下流程参考工具书:《Python3网络爬虫开发实战》
收集各库的.whl的网站:https://www.lfd.uci.edu/~gohlke/pythonlibs
1.Python的安装和配置
1.1前期略
1.2pycharm
1.2.1导包问题
1.2.1.1alt+enter
1.2.1.2导包换源
Pycharm中导包失败的,解决方案:更换国内pip镜像源
2.selenium–>pip下载(下略)
2.1自动化测试工具
from selenium import webdriver
brower=webdriver.Chrome\Firefox\PhantomJS\Edge()
2.2selenium现在不支持phantomjs,3.4.3支持
2.3
pip uninstall selenium
pip install selenium==3.4.3
3.driver–>浏览器
3.1chromedriver–>chrome
3.1.1chrome无头模式代码
3.1.1.1
参考自:python 常见跳坑之selenium框架不支持phantomjs
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')
#上面三行代码就是为了将Chrome不弹出界面,实现无界面爬取
browser = webdriver.Chrome(chrome_options=chrome_options)
3.2geckodriver–>firefox
3.3phantonjs
3.3.1无界面可脚本编程的webkit浏览器引擎
3.4edgedriver–>edge
3.4.1下载地址
https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
4.请求库
4.1request–>pip
4.2aiohttp–>pip
5.解析库的安装
5.1lxml–>pip
5.1.1支持HTML和XML的解析,XPath的解析方式
5.1.2pip安装失败
5.1.2.1Python–lxml库的简单介绍及基本使用
5.1.2.2
whl下载:https://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml
pip install lxml-4.6.3-cp310-cp310-win_amd64.whl
5.2beautiful soup–>pip
5.2.1pip install beautifulsoup4
5.3pyquery–>pip
5.4tesserocr–>浏览器安装tesseract,pip
5.4.1tesseract下载地址:https://digi.bib.uni-mannheim.de/tesseract/
5.4.2tesseract 安装及使用
windows 10环境下安装Tesseract-OCR与python集成
tesserocr 的安装
5.4.3
基于Python的OCR实现
6.数据库的安装
6.1mysql
6.2MongoDB
6.3redis
最新版Redis安装配置教程(Windows+Linux)
7.储存库的安装
6.1pymysql–>pip
6.2pymongo–>pip
6.3redis-py–>pip install redis
6.4RedisDump
7.web库的安装
7.1flask–>pip
7.2tornado–>pip
8.app相关库
8.1
9.爬虫框架
9.1pyspider–>pip 高版本python不要用这个
9.1.1pycurl错误
python3.6安装pyspider出现的问题(pycurl安装失败)和解决方案
pip install pycurl-7.44.1-cp310-cp310-win_amd64.whlpys
9.2Scrapy
Scrapy安装(windows)
9.3scrapy-splash–>docker
9.4scrapy-redis–>pip
10.部署相关库
10.1docker
下载地址:https://docs.docker.com/desktop/windows/install/
10.2scrapyd–>pip
10.3scrapyd-client–>pip
10.4scrapy API–>pip
pip install python-scrapyd-api
10.5scrapyrt–>pip
10.6gerapy–>pip

本文详细介绍了Python爬虫开发中从环境配置到库安装的步骤,包括Selenium自动化测试、webdriver选择、requests和aiohttp请求库、lxml和BeautifulSoup解析、数据库如MySQL和MongoDB安装,以及Web框架Flask和Scrapy的使用。重点讲解了如何解决pip安装问题和选择合适的无头浏览器驱动。

1126

被折叠的 条评论
为什么被折叠?



