今天在安装使用pytesseract的时候遇到的两个,在这里记录一下解决方案。
pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it's not in your path
这个问题是因为我们在python中要想使用tesseract,不只是需要安装pytesseract库,还需要安装tesseract程序,并将路径添加到pytesseract中。
这里贴一个下载地址:https://github.com/tesseract-ocr/tesseract/wiki
然后需要将pytesseract.py中的tesseract_cmd改为安装的地址,如下图所示。如果是pycharm用户的话直接连按两下shift进行搜索即可。
windows 10 :pytesseract.pytesseract.TesseractError: (1, 'Error opening data file \\Program Files (x86)\\Tesseract-OCR\\tessdata/chi_sim.traineddata') #50
这个错误是因为tesseract和你的项目没有放在同一个硬盘,所以会报错。这种情况只需要重新安装在对应的硬盘即可。
我是在github上找到的解决方案: