1. Install Python
Brew Install Python
2. Installation PIL and image format support
Download
Http://www.pythonware.com/products/pil/index.htm
Extract
Tar-xzf imaging-1.1.7.tar.gz
Installing PIL
CD Imaging-1.1.7
sudo python setup.py install
Install Picture format support
Brew Install Libpng
Brew Install JPEG
Brew Install Libtiff
(Note: PIL still cannot support TIFF-formatted images after installing Libtiff, for reasons not yet known)
3. Installing Leptonica
Brew Install Leptonica
4. Installing TESSERACT-OCR
Brew Install Tesseract
5. Installing the Pytesseract Library
Installing the PIP tool
sudo easy_install pip
Installing Pytesseract
sudo pip install pytesseract
6. Write the Python script and run it
Import pytesseractfrom PIL Import imageimage = Image.open (' yzm.png ') image.load () image.split () Vcode = Pytesseract.image _to_string (image) Print Vcode
Where Yzm.png is the same directory as the Captcha picture, and the py script
The py script is saved as yzm.py and runs
Python yzm.py
Show results
Original Python uses Pytesseract library identification verification Code (MAC system)