解决:pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it‘s not in your PATH. See README file for more information.
问题:使用pytesseract库识别图片中文字时出现报错
代码:
- import pytesseract
- from PIL import Image,ImageEnhance
- img=Image.open(r'F:\Test\venv\vfi_code.png')
- #修改图片的灰度,提高识别准确性
- img=img.convert('RGB')
- enhancer=ImageEnhance.Color(img)
- enhancer=enhancer.enhance(0)
- enhancer=ImageEnhance.Brightness(enhancer)
- enhancer=enhancer.enhance(2)
- enhancer=ImageEnhance.Contrast(enhancer)
- enhancer=enhancer.enhance(8)
- enhancer=ImageEnhance.Sharpness(enhancer)
- img=enhancer.enhance(20)
- code=pytesseract.image_to_string(img,lang='chi_sim')
- print(code)
原因:在安装pytesseract库后还需要安装Tesseract-OCR才能正常使用
解决办法:
1)先下载对应版本的Tesseract-OCR并安装,安装时记得把语言包都勾上。下载链接:Index of /tesseract
没有勾选语言包会有这个报错:
pytesseract.pytesseract.TesseractError: (1, 'Error opening data file C:\\Program Files\\Tesseract-OCR/tessdata/chi_sim.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language \'chi_sim\' Tesseract couldn\'t load any languages! Could not initialize tesseract.')
2)将安装路径C:\Program Files\Tesseract-OCR 添加到系统环境变量Path里;再增加一个TESSDATA_PREFIX变量名,变量值还是我的安装路径C:\Program Files\Tesseract-OCR\tessdata这是将语言字库文件夹添加到变量中;
3)打开终端,输入:tesseract -v,可以看到版本信息
解决:pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it‘s not in your PATH. See README file for more information.的更多相关文章
- pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it's not in your path && FileNotFoundError: [WinError 2] 系统找不到指定的文件。
C:\Users\k\Desktop\test>python test.py Traceback (most recent call last): File , in run_tesseract ...
- pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it's not in your path
使用pytesseract识别验证码中遇到异常如下: pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installe ...
- 解决pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it's not in your path问题
解决方案: 找到python的安装路径下的pytesseract: 例如我的是 C:\develop\Python\Lib\site-packages\pytesseract .用文本编辑器打开 ...
- pytesseract.pytesseract.TesseractError: (1, 'Error opening data file /usr/local/share/tessdata/chi_sim.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata"
pytesseract.pytesseract.TesseractError: (1, 'Error opening data file /usr/local/share/tessdata/chi_s ...
- 报错解决——pytesseract.pytesseract.TesseractError: (1,’Error opening data file /usr/local/share/tessdata/eng.traineddata’)
解决方法:(原文地址http://stackoverflow.com/questions/14800730/tesseract-running-error) $ wget https://tesser ...
- tesseract-ocr和tesseract.exe is not installed or it's not in your path问题解决
一.解决方案: 1.http://www.ddooo.com/softdown/94968.htm 打开下载的压缩包,找到"tesseract-ocr-setup-3.02.02.exe ...
- 解决: org.iq80.leveldb.DBException: IO error: C:\data\trie\000945.sst: Could not create random access file.
以太坊MPT树的持久化层是采用了leveldb数据库,然而在抽取MPT树代码运行过程中,进行get和write操作时却发生了错误: Caused by: org.fusesource.leveldbj ...
- 解决tomcat开始出现in production environments was not found on the java.library.path:xxx
如图所看到的,Eclipse中启动tomcat时出现not found on the java.library.path等信息.能够通过下载tomcat-native-1.1.32-win32-bin ...
- 如何解决"The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path"
今天我在eclipse上搭建新项目时,莫名其妙的出现这个错误,如下: The superclass "javax.servlet.http.HttpServlet" was not ...
- 解决spark运行中failed to locate the winutils binary in the hadoop binary path的问题
1.下载hadoop-common-2.2.0-bin并解压到某个目录 https://github.com/srccodes/hadoop-common-2.2.0-bin 2.设置hadoop.h ...
随机推荐
- python对文件的处理方法
#1.打开文件 如果文件不存在会报错 file = open("1.txt") #2.使用w.w+.a.a+模式打开,如果文件不存在就创建文件 file = open(" ...
- csec的key更新
在对csec的使用中(其他遵循hsm key update协议的芯片也适用),kdf的运算过程中遇到的数据都是128bit.不需要考虑padding的问题.目前并没有找到对padding的一致性的处理 ...
- 三星电子的KNOX安全技术难以满足企业BYOD控管需求
不可否认的是三星在智能手机领域里的辉煌战绩,三星最近推出了端到端的基于Android平台的解决方案KNOX,并且宣称可以提供从硬件到应用层的多重安全加固. KNOX是否能够延续其在企业领域里辉煌呢?相 ...
- 《深入剖析Nginx》 笔记
nginx的编译安装使用Linux下通用的三板斧即可:./configure make make install 查看帮助选项./configure --help 禁用编译器优化方法一:CFLAGS= ...
- IDEA 开发SSM
1.配置MAVEN 2.初始化SpringBoot 官网API:https://spring.io/projects/spring-boot 初始化SpringBoot:https://start.s ...
- Unity中的深度测试相关知识与问题
https://www.jianshu.com/p/f420b55edd0b?utm_campaign=hugo
- 对于小白如何才能学好Java
我们学习任何一种编程语言,不是去无目的的网上找太多的教程,而是首先从宏观了解它的基本思想方法定义概念,从宏观感受它的逻辑与抽象,然后是实践,不断的实践.今天我们看看网上给我们小白的一些学习建议. 一. ...
- phaclon 初学者遇到的问题!
1,框架安装 需要安装PHALCON扩展. 2,Nginx伪静态 配置 3,app.ini 常量配置等配置 4,主体目录结构 互相调用及 类的注册服务 依赖注入 自动加载项问题. 5,数据库相关操 ...
- Codeforces Global Round 17 - D. Not Quite Lee
裴蜀定理 + lowbit Problem - D - Codeforces 题意 定义一个包含 \(m\) 个元素的数组 \(b\) 是好的,当且仅当满足以下两个条件 对于 \(b[i]\), 存在 ...
- PostProcess
后处理器: AutowiredAnnotationBeanPostProcess.class 可以处理@Autowired.@Value 如何注册:context.registerBean(xxx.c ...