About pytesseract module image verification code

Error type:

pytesseract.pytesseract.TesseractError: (1, 'Error opening data file C:\\Program Files (x86)\\Tesseract-OCR;/eng.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language \'eng\' Tesseract couldn\'t load any languages! Could not initialize tesseract.')

Solution:

1, the first attempt to modify pytesseract.py module which line method on procedural path:

Open source pytesseract

find tesseract_cmd = 'tesseract'

found the top line comment # CHANGE THIS IF TESSERACT IS NOT IN YOUR PATH, OR IS NAMED DIFFERENTLY

due TESSERACT where different directory, you need to manually change the directory

this line modified to

tesseract_cmd = r'C: \ Program Files (x86) \ Tesseract- OCR \ tesseract.exe '

2, if not enough, then

May be due at the time of installation, the default in addition to outside tesseract engine, as well as install tesseract-related language library, and the default English only one of which is stacked to live, you need to click on the '+' sign, check the Chinese and math, (that is, numeric ), and then shut down restart it

Guess you like

Origin www.cnblogs.com/Qiuzhiyu/p/12163689.html