windows下tesserocr安装失败

windows下tesserocr安装失败

   小白     2020年7月15日 05:25     1609    

直接使用pip3 install tesserocr pillow的时候报错。

1.png

 

可以直接在github上下载whl文件

下载地址whl: https://github.com/simonflueckiger/tesserocr-windows_build/releases

找对对应python的版本。

python --version

2.png

3.png

pip3 install tesserocr-2.4.0-cp37-cp37m-win_amd64.whl

4.png

 

或者直接使用URL进行安装

pip3 install https://github.com/simonflueckiger/tesserocr-windows_build/releases/download/tesserocr-v2.4.0-tesseract-4.0.0/tesserocr-2.4.0-cp37-cp37m-win_amd64.whl

5.png

 

测试下

import tesserocr

from PIL import Image

image = Image.open('C:/Users/Design-07/Desktop/1.jpg')

print(tesserocr.image_to_text(image))

 

在执行后,会提示以下错误

RuntimeError: Failed to init API, possibly an invalid tessdata path: C:\Users\Design-07\AppData\Local\Programs\Python\Python37\/tessdata/

只要将Tesseract目录下的tessdata复制到错误中对应的目录中,也就是C:\Users\Design-07\AppData\Local\Programs\Python\Python37中,这个根据实际情况进行配置。


文章评论

0

其他文章