Python3爬虫利器:tesserocr的安装

498次阅读
没有评论

Python3爬虫利器:tesserocr的安装

现如今,验证码成为验证身份的一种方法,在使用python爬取网站时,我们总会遇到识别验证码的情况,这时我们需要安装tesserocr,tesserocr是Python的一个OCR识别库,但其实是对tesseract做的一层Python API封装,所以它的核心是tesseract。

一、相关链接

GitHub:https://github.com/sirfz/tesserocr

PyPI:https://pypi.python.org/pypi/tesserocr

下载地址:http://digi.bib.uni-mannheim.de/tesseract

GitHub:https://github.com/tesseract-ocr/tesseract

语言包:https://github.com/tesseract-ocr/tessdata

文档:https://github.com/tesseract-ocr/tesseract/wiki/Documentation

二、pip安装

在cmd下通过pip来安装:(前提是安装了pip,一般python都自带)

pip install tesserocr

注意:由于windows下tesserocr 2.3.0版本目前还没有,所以pip安装在Windows下面会报错。

解决方法:通过wheel安装

1、下载tesserocr 2.2.2版本的wheel文件(注意与tesseract版本的对应)

2、通过如下命令安装:(需要与下载文件在同一目录下)

pip install 文件名.whl

三、验证安装

直接调用file_to_text()方法,如果成功输出结果,则证明tesseract和tesserocr都已经安装成功。

import tesserocr
print(tesserocr.file_to_text('image.png'))

输出

Python3WebSpider

以上就是Python3爬虫利器tesserocr的安装介绍,希望能对你有所帮助哟~

神龙|纯净稳定代理IP免费测试>>>>>>>>天启|企业级代理IP免费测试>>>>>>>>IPIPGO|全球住宅代理IP免费测试

相关文章:

版权声明:wuyou2021-07-18发表,共计854字。
新手QQ群:570568346,欢迎进群讨论 Python51学习