pytesseract 安装错误总结

项目场景:

win10操作系统

使用eclipse调用pytesseract接口,进行OCR识别。

在anaconda的python3.6.4版本,安装配置pytesseract


问题描述

pip install pytesseract 报错

错误提醒:pytesseract requires Python '>=3.7' but the running Python is 3.6.4

 pip install 安装pytesseract 最新版本,支持python3.7以上版本,现有Python版本3.6,无法安装。

解决方案:下载pytesseract以前的版本

查看pytesseract历史版本,python3.6大概2018年前后,选了个2018出的版本0.2.7,https://pypi.org/project/pytesseract/0.2.7/#history

使用pip install pytesseract==0.2.7,安装成功

pytesseract 安装错误总结_第1张图片

验证pytesseract 

import pytesseract
from PIL import Image
image = Image.open("C:/Users/water/Desktop/数字一家人.jpg")
result = pytesseract.image_to_string(image)

报错: 

pytesseract.pytesseract.TesseractError: (1, 'Error opening data file \\Program Files (x86)\\Tesseract-OCR\\eng.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language \'eng\' Tesseract couldn\'t load any languages! Could not initialize tesseract.')

'打开数据文件\\Program Files(x86)\\Teseract OCR\\eng.traineddata时出错请确保TESSDTA_PREFIX环境变量设置为“TESSDATA”目录。加载语言失败Teseract无法加载任何语言!无法初始化tesseract。'

pytesseract 安装错误总结_第2张图片

 设置TESSDTA_PREFIX环境变量为“tessdata”目录

pytesseract 安装错误总结_第3张图片

依旧提醒原来错误

pytesseract 安装错误总结_第4张图片

解决方法:卸载pytesseract==0.2.7,重新安装旧的版本,选择2017年版的pytesseract==0.1.8

pytesseract 安装错误总结_第5张图片

 安装2017年版的pytesseract==0.1.8

pytesseract 安装错误总结_第6张图片

 验证pytesseract,识别出图像

>>> image = Image.open("C:/Users/water/Desktop/数字一家人.jpg")
>>> result = pytesseract.image_to_string(image)
>>> result.strip()
'HF A\n\n© 7 $ 10 Tu\n\n12\n18\n24\n30\n36\n42\n48\n54\n60\n66\n72\n78\n84\n90\n\n96\n\n14\n21\n2 8\n35\n42\n49\n56\n63\n70\n717\n84\n9 1\n98\n\n16\n24\n32\n40\n48\n56\n64\n72\n80\n88\n96\n\nx\n&\n\n18\n2]\n36\n45\n54\n63\n72\n8 1\n90\n99\n\n20\n30\n40\n50\n60\n70\n80\n90\n\n» ® | #$\n\n2 2\n3 3\n44\n55\n66\n77\n88\n\nCO\nCO\n\n& (t T # of fo 3 $&'

附录

pytesseract的git地址:https://gitcode.net/mirrors/madmaze/pytesseract?utm_source=csdn_github_accelerator

pytesseract各版本:https://pypi.org/project/pytesseract/0.2.7/#history

感谢:

Python 3.6 版本-使用Pytesseract 模块进行图像验证码识别https://www.shuzhiduo.com/A/6pdDQjxqzw/

tesseract OCR 和Python pytesseract下载与安装_codeQin的博客-CSDN博客_pytesseract下载(一) tesseract OCR1.下载地址:https://digi.bib.uni-mannheim.de/tesseract/2.环境变量PATH配置“电脑-属性-高级系统设置-环境变量-系统变量-PATH”①软件安装路径:D:\vscode\tesseract-OCR②PATH新增3.验证安装是否成功(二)Python pytesseract1.下载:执行命令pip install pytesseract或者至https://github.co...https://blog.csdn.net/qq_42394743/article/details/119986787Python 3.6 版本-使用Pytesseract 模块进行图像验证码识别https://www.shuzhiduo.com/A/6pdDQjxqzw/

你可能感兴趣的:(计算机视觉,python,开发语言,opencv,计算机视觉)