最新版本的tesseract-ocr 3.0.4 需要运行于python2.7版本以上,因此需要升级系统中默认的2.6版本python及Mod_WSGI

1,下载安装Python-2.7.10

>tar xJvf  Python-2.7..tar6.xz
>cd Python-2.7.
# 这里,必须用–enable-shared,生成动态库,否则会遇到wsgi不能编译的问题。
>./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,安装python2.7的mod_wsgi

>pip install mod_wsgi

如果安装python2.7.10时没有加入--enable-shared参数,安装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 be 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, 替换系统默认Mod_wsgi

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

4,运行apache,报错找不到ocr模块,然而在调试环境下没有问题,经查看pyocr的源码发现,pyocr.get_available_tools()  是通过在环境变量os.environ["PATH"]中查看有没有tesseract命令,因此需要将tesseract的安装路径/usr/local/bin/tesseract加入PATH中,然后重新启动,或者在python程序中自己加入路径/usr/local/bin

CentOS 6 安装 python 2.7 和 mod_wsgi 运行pyocr[tesseract]的更多相关文章

  1. centos上安装python环境

    1.安装python-pip ​ 首先安装epel扩展源: ​ yum -y install epel-release ​ 更新完成之后,安装pip: ​ yum -y install python- ...

  2. 在CentOS上安装Python

    首先我们需要在服务器上安装一个比较新的 Python,CentOS 5.8 默认装的 Python 是 2.4.3. [root@nowamagic ~]# python -V Python 我们需要 ...

  3. centos下安装python

    下载网址:http://ftp.gnu.org/gnu/gdb/ 1.编译python必须安装开发工具 # yum groupinstall "Development tools" ...

  4. centos 7安装python 3

    linux-Centos7安装python3并与python2共存   1.查看是否已经安装Python CentOS 7.2 默认安装了python2.7.5 因为一些命令要用它比如yum 它使用的 ...

  5. centos下 安装python相关

    centos 安装python相关 python3 https://blog.csdn.net/tanxiaob/article/details/78725301 yum -y install zli ...

  6. centos如何安装python库?

    通过yum install安装,先解决yum不能安装python库的问题 yum install -y  epel-release  #先安装epel源,参考http://sharadchhetri. ...

  7. centos 7 安装python 3.x

    首先 安装一些 可能需要的依赖: yum -y groupinstall "Development tools" yum -y install zlib-devel bzip2-d ...

  8. CentOS 6 安装 python and pip

    yum update yum list python*     //查看可安装python包 yum install python34.i686_64 wget https://bootstrap.p ...

  9. Centos下安装Python的问题汇总

    Python下载地址(https://www.python.org/ftp/python/) 一.工具安装 1.Python的安装 tar vxf Python-2.7.13.tgz cd Pytho ...

随机推荐

  1. 【笔记】select2的使用

    <script src="~/Scripts/jquery-1.10.2.js"></script> <script src="~/Cont ...

  2. .NET Core是什么?

    [初步理解] .NET Core 是一个开源的.跨平台的 .NET 实现.而 .NET Framework 是基于 Windows 的 .NET 实现,Mono 是 .NET Framework 的一 ...

  3. Linux WAS7 启动异常

    启动server1异常,信息如下: [root@cmiecmceprd02 bin]# ./startServer.sh server1ADMU0116I: Tool information is b ...

  4. 在项目中引用GreenDroid库

    1.下载GreenDroid库 首先,我们得从Git上下载这个库,我用的是git for windows下载的.先下载,安装.安装完后,打开git for windows ,直接将浏览器中GreenD ...

  5. [stm32] 利用uc-gui封装画图和画线函数移植51上的模拟动画

    >_<:这里的动画是黄色矩形区域中一个模仿俯视图的起重机运作动画,一个是模仿主视图的吊钩的运动.通过改变初始Init函数中的数据b_x,b_y实现矩形区域的移动.当实时采集时要首先根据起重 ...

  6. SAFS Init Files

    There're many deployment files for configuration. We need to learn how SAFS read these depolyment fi ...

  7. android: 使用 IntentService

    9.5.2 使用 IntentService 话说回来,在本章一开始的时候我们就已经知道,服务中的代码都是默认运行在主线程 当中的,如果直接在服务里去处理一些耗时的逻辑,就很容易出现 ANR(Appl ...

  8. React中props.children和React.Children的区别

    在React中,当涉及组件嵌套,在父组件中使用props.children把所有子组件显示出来.如下: function ParentComponent(props){ return ( <di ...

  9. 多台linux服务器时间同步

    1,设置A机时间服务器: a,修改 /etc/ntp.conf,如下: # Undisciplined Local Clock. This is a fake driver intended for ...

  10. django文件上传下载

    views: def mgmt_files(request): #列出树形目录,上传文件页面 if request.method == 'POST': path_root = "D:\\py ...