错误提示:
Traceback (most recent call last):
File "F:/python_project/Security_code_Test/pic_Test.py", line 5, in <module>
result=tesserocr.image_to_text(image)
File "tesserocr.pyx", line 2407, in tesserocr._tesserocr.image_to_text
RuntimeError: Failed to init API, possibly an invalid tessdata path: F:\python 3.7.0\/tessdata/
解决办法:
1.找到tesseract工具的安装路径,打开根目录tesseract -> Tesseract-OCR -> 找到tessdata文件夹复制
2.粘贴在python安装目录的根目录下
3.再次运行代码
成功显示结果:
"F:\python 3.7.0\python.exe" F:/python_project/Security_code_Test/pic_Test.py
KSUB
Process finished with exit code 0
网友评论