win10下如何安装tesserocr(ImportError: DLL load failed: 找不到指定的模块。)

版权声明:本文为博主原创文章,使用或转发和分享时需要标明来源的链接地址 https://blog.csdn.net/zulien/article/details/84990488

在Windows下,要先下载tesseract,它为tesserocr提供了支持;
tesseract下载地址:http://digi.bib.uni-mannheim.de/tesseract/
打开后,可以看到各种exe的列表,可以随便挑选;
其中文件名中带有dev的为开发版本,不带dev则为稳定版本,例如: tesseract-ocr-setup-3.05.02-20180621.exe;

这里需要勾选红框里的Additional language data(download),这个选项是安装OCR识别支持的语言包,这样OCR就可以识别多国语言,然后再一路点击NEXT即可,因为要下载语言包,所以需要点时间,大概10-20分钟左右,跟网速有关,如果不需要支持多国语言的话,也可以不勾选,自由选择
需要说明:默认包含英文字库
如果,觉得一次下载那么多语言占空间,又或者觉得网速慢,也可以选择单独安装中文字库;
字库下载地址:http://github.com/tesseract-ocr/tessdata
打开后,直接搜索chi_sim.traineddata,这个代表的就是中文,下载下来;
然后找到刚刚tesseract安装目录,里面会有一个叫tessdata的目录,直接把刚下载的语言包放到这个目录下即可;

如何验证tesseract是否安装成功?cd安装位置cmd下输入tesseract即可;
成功会直接显示信息;

接下来就 安装tesserocr ,直接pip命令即可:

pip3 install tesserocr

但在安装的时候,直接报错(这里报错情况比较多,就不一一进行贴图):

相关链接:

tesserocr GitHub:https//github.com/sirfz/tesserocr

tesserocr PyPI:https://pypi.python.org/pypi/tesserocr

tesseract下载地址:http : //digi.bib.uni-mannheim.de/tesseract

tesseract GitHub:https//github.com/tesseract-ocr/tesseract

tesseract语言包:https//github.com/tesseract-ocr/tessdata

tesseract文档:https//github.com/tesseract-ocr/tesseract/wiki/Documentation

pip3 install tesserocr-2.2.2-cp36-cp36m-win_amd64.whl

测试程序:

import tesserocr

from PILimport Image

image = Image.open('image.jpg')#open image

#print(image)

print(tesserocr.image_to_text(image))

如果报错:

pip3 install cv2wrap

修改测序程序:

import cv2
import tesserocr

from PILimport Image

image = Image.open('image.jpg')#open image

#print(image)

print(tesserocr.image_to_text(image))

猜你喜欢

转载自blog.csdn.net/zulien/article/details/84990488