Mac configuration Tesseract picture identification text

python3

from PIL import Image
import pytesseract

# The above package is turned, only the following line image can be realized the character recognition 
text = pytesseract.image_to_string (Image.open ( ' ../picture/2.png ' ), lang = ' chi_sim ' )
 Print (text)

 

Set the environment variable language:

TESSDATA_PREFIX=/usr/local/Cellar/tesseract/4.0.0_1/share/tessdata
export TESSDATA_PREFIX

 

Guess you like

Origin www.cnblogs.com/beaconSky/p/11965125.html