Python3 for win10x64 Pillow,pytesserac and tesseract text recognition simple configuration.

Source: Internet
Author: User

In fact, do not count their own, in the internet looking for the west, one block problem solved.

The procedure of the Harmonious society the apes don't all do that. 650) this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0064.gif "alt=" J_0064.gif "/>

On the right dish.

Install Pillow First

Windows 10 first opens a command prompt:

Note: I do not know why I pretend to be a Python 3.5 when the egg hurts. The administrator installation is selected, so administrator privileges are required to run the command prompt. Don't tell me how to do it.

1. Installing Pillow

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/A7/3F/wKioL1nkOkiS6F9jAAAqgQgYYSI625.png "title=" 1.png "alt=" Wkiol1nkokis6f9jaaaqgqgyysi625.png "/>

2. Installing Pytesseract

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/A7/3F/wKioL1nkOrHQhmAXAAArYaTVmx4574.png "title=" 2.png "alt=" Wkiol1nkorhqhmaxaaaryatvmx4574.png "/>

3. Re-install the TESSERACT-OCR, note that this relationship is the core of Word recognition program.


650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/A7/40/wKioL1nkOzzCfPpyAABrUOq_Vpk670.png "title=" 3.png "alt=" Wkiol1nkozzcfppyaabruoq_vpk670.png "/>

Error, it seems that the front is too smooth, Python can not see the past.

As for the error message: Error:microsoft Visual C + + 14.0 is required. Get it with "Microsoft Visual C + + Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

Let me go to this site to install Microsoft Visual C + + 14.0 related Dongdong, n n D i open the site, download after installation, see the space required 4GB. Can't play, or forget, I am a rookie, too many things do not understand, so do not embarrass me.

So find other ways to install TESSERACT-OCR.

There is a TESSERACT-OCR for Windows installation method. Installation steps our powerful Niang has:

Http://jingyan.baidu.com/article/219f4bf788addfde442d38fe.html

What font to choose when installing.


Lazy Connection: Https://digi.bib.uni-mannheim.de/tesseract/tesseract-ocr-setup-4.00.00dev.exe

MAC LINUX WINDOWS Editions download

Https://github.com/tesseract-ocr/tesseract/wiki


The relevant procedures are basically installed.

Start making a small program reference diagram as follows:

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/08/90/wKiom1nkQJjBez0wAAAIUXOrvvA489.png "title=" QQ picture 20171016100111.png "alt=" Wkiom1nkqjjbez0waaaiuxorvva489.png "/>

I practiced in Pycharm, the code is as follows:

From PIL import Imageimport pytesseractimg = Image.open () Text = pytesseract.image_to_string (img) print (text)

Note: I named the above reference map 22.png, because I'm too 2.

Several programs are installed to see how the effect works:

"C:\program files\python35\python.exe"  D:/Python_Study3.5/test/pli_png.pyTraceback  (most  Recent call last):  file  "d:/python_study3.5/test/pli_png.py",  line 4,  in <module>    text = pytesseract.image_to_string (IMG)    File  "c:\program files\python35\lib\site-packages\pytesseract\pytesseract.py", line  122, in image_to_string    config=config)   File  "c:\program  files\python35\lib\site-packages\pytesseract\pytesseract.py ",  line 46, in run_tesseract     proc = subprocess. Popen (command, stderr=subprocess. PIPE)   File  "c:\program files\python35\lib\subprocess.py",  line 676, in  __init__    restore_signals, start_new_session)   File  "c \ program files\python35\lib\subprocess.py ",   line 957, in _execute_child    startupinfo) FileNotFoundError: [ The winerror 2]  system cannot find the file specified.

M D can not find the specified file, I do not understand here, continue to Baidu. Then find the article that says you want to change some of the configuration of the pytesseract.py file (the second installed module). Because this configuration has a few related to TESSERACT-OCR (that is, the third installed program)

The changes are as follows:

Open pytesseract.py in Pycharm:

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/A7/40/wKioL1nkP-vi8E9AAAEsK-61O3M108.png "title=" 4.png "alt=" Wkiol1nkp-vi8e9aaaesk-61o3m108.png "/>

On the right open window found: tesseract_cmd This line of code:

This line commented out: Because the pytesseract.py file in the default TESSERACT-OCR of the main program environment variables do not know how to change, to Windows can not be run, the above error code executed in the file is not found, in fact, the main program is not found. So comment out the original, we add a new line. The path above is the path when you install the TESSERACT-OCR program:

#tesseract_cmd = ' Tesseract '

Add a new line:

Tesseract_cmd = R ' C:/Program Files (x86)/tesseract-ocr/tesseract.exe '

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/08/91/wKiom1nkRUfz20F7AADvwnYBt5M064.png "title=" 5.png "alt=" Wkiom1nkrufz20f7aadvwnybt5m064.png "/>

Save, run the code we wrote to see the effect.

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/08/91/wKiom1nkSzeS6dLvAAEM0yZJhzI952.png "title=" 6.png "alt=" Wkiom1nkszes6dlvaaem0yzjhzi952.png "/>

I've got an error and I can't hurt you.

"C:\Program Files\python35\python.exe" D:/python_study3.5/test/pli_png.pytraceback (most recent call last): File "d:/ python_study3.5/test/pli_png.py ", line 4, in <module> text = pytesseract.image_to_string (img) File" C:\Program F iles\python35\lib\site-packages\pytesseract\pytesseract.py ", line A, in image_to_string raise Tesseracterror ( status, Errors) Pytesseract.pytesseract.TesseractError: (1, ' Error opening data file \\Program Files (x86) \TESSERACT-OCR \\eng.traineddata ') Process finished with exit code 1

The error of this report seems to be unable to find the TESSERACT-OCR configuration file. It looks like you have to change the pytesseract.py file.

So I found something from the Internet, and continue to change.

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/08/91/wKiom1nkTQTzUT7jAAElGHVRitU225.png "title=" 7.png "alt=" Wkiom1nktqtzut7jaaelghvritu225.png "/>

Save, and then run the program:

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/08/91/wKiom1nkTXvxfsImAACAXR2BKkE309.png "title=" 8.png "alt=" Wkiom1nktxvxfsimaacaxr2bkke309.png "/>

What success, although the recognition of a small number of points, but at least no error.


I tried to get here, and I couldn't do much of it.



Most of the above is from the Internet. I just do the finishing.

It's wrong, MO, I don't know much about that.



This article is from the "Learning Path" blog, please be sure to keep this source http://13136244.blog.51cto.com/13126244/1972816

Python3 for win10x64 Pillow,pytesserac and tesseract text recognition simple configuration.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.