pytesseract+pillow

1. First prepare the environment:

python Version: 2.7 / 3.6

Operating System: windows system

2. Preparation Tool:

tesseract-ocr (Baidu network disk address: https: //pan.baidu.com/s/1OL0g1MBzeijD23JN0UGC0Q)

Pycharm (Download: http: //www.jetbrains.com/pycharm/download/#section=windows)

3. Install the python-related packages (used by the author is py2.7)

pip install Pillow

pip install pytesseract

4. tesseract-ocr and associating the python, so python can call Tesseract-OCR program identification codes / Text:

C:\python27\Lib\site-packages\pytesseract\pytesseract.py

Modifying the first document pytesseract.py tesseract_cmd 24 rows of point Tesseract-OCR tesseract.exe

Original content:

 

 

 

Modified content:

 

 

 

Note: Be sure to pay attention to the novice / and \ distinction

5. Open Pycharm writing process:

 

 

 

The need to tell the novice aaa.jpg which is stored in the directory py script, lang = 'chi_sim' on behalf of Chinese recognize, if not not recognize Chinese

6. Run the script can see the results

Special note: If the steps exactly right, but the operation error, please uninstall pytesseract reinstall the problem will be solved (uninstall command pip uninstall pytesseract)

Guess you like

Origin www.cnblogs.com/baoshilin/p/12401864.html