CentOS 6 Installation Python 2.7 and Mod_wsgi run Pyocr[tesseract]

Source: Internet
Author: User

The latest version of TESSERACT-OCR 3.0.4 needs to run above the python2.7 version, so you need to upgrade the default version of 2.6 Python and Mod_wsgi in the system

1, download and install Python-2.7.10

>tar xjvf  python-2.7.  Ten. Tar6.xz>cd  python-2.7.   Here, you must use –enable-shared to generate a dynamic library, or you will encounter problems that WSGI cannot compile. >./configure--enable-shared  >make make-install
#替换原来的默认python
>mv/usr/bin/python/usr/bin/python2.6
>ln-s/usr/local/bin/python2.7/usr/bin/python
#设置lib路径
>ldconfig/usr/local/lib
#查看python状态
>python-v

2, install the python2.7 Mod_wsgi

Install Mod_wsgi

If the--enable-shared parameter is not added when installing python2.7.10, the following error is reported when installing MOD_WSGI:"recompile with-fpic"

......
/USR/BIN/LD:/usr/local/lib/libpython2.7.a (ABSTRACT.O): Relocation r_x86_64_32 against '. rodata.str1.8 ' can not is used When making a shared object; Recompile with-fpic
/usr/local/lib/libpython2.7.a:could not read Symbols:bad value
Collect2:ld returned 1 exit status
Apxs:Error:Command failed with rc=65536

3, replace the system default Mod_wsgi

>mv /usr/lib64/httpd/modules/mod_wsgi.so/usr/lib64/httpd/modules/>ln -s/usr/ Local/lib/python2. 7/site-packages/mod_wsgi/server/mod_wsgi-py27.so/usr/lib64/httpd/modules/mod_wsgi.so

4, run Apache, error can not find the OCR module, however in the debugging environment no problem, after viewing PYOCR source discovery, Pyocr.get_available_tools () is through the environment variable os.environ["PATH" To see if there is a tesseract command, you need to add Tesseract's installation path/usr/local/bin/tesseract to path and then reboot, or join the path yourself in the Python program/usr/local/bin

CentOS 6 Installation Python 2.7 and Mod_wsgi run Pyocr[tesseract]

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.