解决: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 ...
随机推荐
- B - Yet Another Palindrome Problem
B - Yet Another Palindrome Problem 思路: 给一个长为n(≤5000≤5000)的数组,问是否存在一个长度至少为3的子序列是回文的.回文的定义是把序列reverse, ...
- redis缓存一致性
redis缓存一致性 redis是目前使用最广泛的分布式缓存系统,几乎每家公司都在用.它使用简单,吞吐量高,单机 qps 可以达到 10 万每秒,但在使用redis缓存时存在一个问题,即如何保证缓存数 ...
- 17.SQLite数据库存储
Android系统内置一个SQLite数据库,SQLite是一款轻量级的关系型数据库,它的运算速度非常快,占用资源很少,通常只需要几百K的内存就足够了. SQLite不仅支持标准的SQL语法,还遵循了 ...
- Windows10下SecureCRT、SecureFX安装与破解(超级详细)
整理了Windows10下最新版本SecureCRT9.1.SecureFX9.1安装 1.资源地址: 链接:https://pan.baidu.com/s/1XoQqpRlpBm6Tvc0fHni6 ...
- day11 事件相关笔记
day11 事件上 事件的概述 事件是指代一个东西的操作被另外一个东西监听以后的一个过程(事件),这个过程可以完成对应的操作(处理函数)事件监听器是一个标准的观察者模式(observer)也被称为订阅 ...
- Jenkins+maven+gitlab+harbor+Rancher
- 第12周 预习、实验与作业:Java并发编程
以前你编写的Java程序同时能做几件事情?有几个执行流程?main方法执行完,整个程序一定会退出吗? 最多只能做一件事 函数按着顺序执行,函数内按着语句执行.可以有多个可以有一个. 不一定.因为Mai ...
- Java DelayQueue包装类
public class DelayQueueWrapper<T> { private TimeUnit timeUnit; private final Long capacity; pr ...
- 最简单的应用flask
服务端 # -*- coding: utf-8 -*- from flask import Flask,request flask_app = Flask('55kai') @flask_app.ro ...
- 多线程学习(第一天)java语言的线程
一.并发与并行 并发:处理器不停的切换有操作的线程. 并行:多个处理器同时执行有操作线程. 二.启动线程 无论是A,B哪种方式实现多线程,都需要通过Thread.start方法启动线程. A.Thre ...
