Python Verification Code

Source: Internet
Author: User

I am not familiar with python for the first time. Some of them are easy to remember.

1. Install Python and Pil

My centos6 does not know when python is installed.

[Root @ foxni/home/lelefox/simple verification code/image/font] # Python
Python 2.6.6 (r266: 84292, Dec 7 2011, 20:48:22)
[GCC 20110731 (Red Hat 4.4.6-3)] on linux2
Type "help", "Copyright", "Credits" or "License" for more information.
>>>
2. Install PIL

Reference: http://bluecrystal.iteye.com/blog/146490

At the beginning, I only executed $ Python setup. PY, the result is in the image. open (""). convert ("1") (note that the Number 1 is converted to a bilevel image)
, Refer to: Pil document. Readme should take a closer look. If you want to process PNG images, you need to install http://www.zlib.net/, processing JPG images to install other. (These are available in readme and can be found using $ Python selftest. py .)

$ Python setup. py build_ext-I
$ Python selftest. py
$ Python setup. py install

3. By default, image. Open ("). Show () does not respond if XV is not installed.

Install: XV download http://www.trilon.com/xv/downloads.html

When installing the source code out of a small problem, refer to: ftp://ftp.trilon.com/pub/xv/xv-redhat6-readme.txt. Remove the error in the header file. Add comments

 
/* # Ifndef _ NetBSD _ extern char * sys_errlist []; this too... # endif */

In addition, you need to change the MAKEFILE file to a local location.

 
Mchn =-dlinux-L/usr/x11r6/lib

I just removed the comment above this sentence, which is also very useful. The LIB path of X11 is not found.

Refer:

1. http://xiaoxia.org/2011/05/31/boring-entry-the-fabled-verification-code-recognition-technology-learning-notes/

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.