今天在配置tessdata时出现很多问题,上网查阅了很多的博客,终于将问题解决了,现在整理如下:
先申明本人没有通过anaconda安装python环境,直接在官网下载exe文件安装的,所以可能和一些人不一样,但是配置是一样的。
在安装完tesserocr后运行如下代码:
from PIL import Image
import tesserocr
imag=Image.open("D://test1.jpg")
print(tesserocr.image_to_text(imag))
但是报错了,错误如下:
我的做法是这样:将Tesseract-OCR文件夹中的tessdata文件夹拷贝到python的安装目录下即可。
最后成功运行。