pytesseract使用
1.安装pip install pytesseract
2.安装tesseract-ocr,下载地址:https://github.com/UB-Mannheim/tesseract/wiki,我安装的版本tesseract-ocr-setup-3.05.01.exe,安装的时候选择把chi_sim(中文简体)和chi_tra(中文繁体)数据库安装上
3.设置环境变量
4.vcode=pytesseract.image_to_string(im_text, lang='chi_sim')会出错:pytesseract FileNotFoundError: [WinError 2] 系统找不到指定的文件。
解决方法:pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files (x86)\Tesseract-OCR\tesseract.exe'
其中 r'C:\Program Files (x86)\Tesseract-OCR\tesseract.exe'是tesseract-ocr安装路径
5.
pytesseract.pytesseract.TesseractError: (1, 'Error opening data file \\Tesseract-OCR\\tessdata/eng.traineddata')
解决方法:
方法1[推荐]:
将tessdata目录的上级目录所在路径(默认为tesseract-ocr安装目录)添加至TESSDATA_PREFIX环境变量中
例如: C:\Program Files (x86)\Tesseract-OCR
Please make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "tessdata" directory.
方法2: 在.py文件配置中指定tessdata-dir
tessdata_dir_config = '--tessdata-dir "D:\\Tesseract-OCR\\tessdata"'
# tessdata_dir_config = '--tessdata-dir "'C:\\Program Files (x86)\\Tesseract-OCR\\tessdata"'
pytesseract.image_to_string(image, config=tessdata_dir_config) 设置完环境变量重启pycharm
pytesseract使用的更多相关文章
- 关于在 mac上配置pytesseract的相关问题
因为踩了两个小时坑 特别是在配置依赖tesseract-ORC识别库时候的问题 特别麻烦 一定要用brewhome 一定要用brewhome 一定要用brewhome 重要的事情说三遍. 刚开始我在网 ...
- Tesseract pytesseract的安装和使用
Tesseract是开源的OCR引擎,可以识别的图片里的文字,支持unicode(UTF-8)编码,100多种语言,需要下载相应语言的训练数据. 安装: 有两种方法,一种是通过编译源码,比较麻烦.我使 ...
- python识别验证码——PIL,pytesser,pytesseract的安装
1.使用Python识别验证码需要安装Python的图像处理模块(PIL.pytesser.pytesseract) (安装过程需要pip,在我的Python中已经安装pip了,pip的安装就不在赘述 ...
- python 验证码识别库pytesseract的使用
笔者环境 centos7 python3 pytesseract只是tesseract-ocr的一种实现接口.所以要先安装tesseract-ocr(大名鼎鼎的开源的OCR识别引擎). 依赖安装 yu ...
- python下调用pytesseract识别某网站验证码
一.pytesseract介绍 1.pytesseract说明 pytesseract最新版本0.1.6,网址:https://pypi.python.org/pypi/pytesseract Pyt ...
- 使用pytesseract出现的问题
dyld: Library not loaded: /usr/local/opt/jpeg/lib/libjpeg.8.dylib Referenced from: /usr/local/lib/li ...
- pytesseract在识别只有一个数字的图片时识别不出来
大家好,近期在做自动化测试时,遇到了一个问题需要通过识别图片来实现,遂用到了pytesseract模块和tesseract-ocr这个工具.在使用过程中发现,识别带有数字的图片时,如果这个图片上仅有一 ...
- mac使用pytesseract
import locale locale.setlocale(locale.LC_ALL, 'C') import pytesseract import pathlib import tracebac ...
- [python] python3.6 安装 pytesseract 出错
安装pytesseact出错, 下载 tesseract-ocr , 地址 https://github.com/tesseract-ocr/tesseract 修改pytesseract.py 设置 ...
随机推荐
- mysql 中翻页
万变不离其中 select * from tableName where 条件 limit 当前页码*页面容量-1 , 页面容量
- 在for、foreach循环体中添加数组元素
在开发工作中遇到这样一种情形,需要在循环体中动态向遍历中的数组添加元素并在当前循环遍历中使用数组的全部元素. 首先使用foreach循环来遍历数组,将代码简化抽象如下: $arr = array(1, ...
- idea 创建多模块依赖Maven项目
本来网上的教程还算多,但是本着自己有的才是自己的原则,还是自己写一份的好,虽然可能自己也不会真的用得着. 1. 创建一个新maven项目 2. 3. 输入groupid和artifactid,后面步骤 ...
- Kotlin——最详解的类(class)的使用
在任何一门面向对象编程的语言里,类(class)是非常基础.但也是非常重要的一项组成,通俗的说就是万般皆对象,而所说的对象就是我们生成的类.Kotlin也是如此,下面详细为大家介绍Kotlin中的类的 ...
- 简单的一句sql
表1 Id Name 1 张三 2 李四 3 王五 表二 Id Name1 Name2 1 1 2 2 2 1 3 2 3 4 1 3 我现在要查出结果如下: Id Name1 Name2 1 张三 ...
- poj2635The Embarrassed Cryptographer(同余膜定理)
The Embarrassed Cryptographer Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 15069 A ...
- Strange fuction
Problem Description Now, here is a fuction: F(x) = 6 * x^7+8*x^6+7*x^3+5*x^2-y*x (0 <= x <=1 ...
- G彩娱乐网【分享】想要开源自己的代码可以参考一下
作为一个开发者,如果你打算开源自己的代码,千万不要忘记,选择一种开源许可证(license). 许多开发者对开源许可证了解很少,不清楚有哪些许可证,应该怎么选择.本文介绍开源许可证的基本知识,主要参考 ...
- 大家好,我是ZCDHJ
大家好,我是ZCDHJ.CJ C2017级的一名Oier.
- 一起写框架-Ioc内核容器的实现-基础API的定义(三)
Ioc内核要解决的问题 1.被调用方,在程序启动时就要创建好对象,放在一个容器里面. 2.调用方使用一个接口或类的引用(不用使用new),就可以创建获得对象. 解决这个两个问题的思路 1.定义一个对象 ...