CentOS 6 安装 python 2.7 和 mod_wsgi 运行pyocr[tesseract]
最新版本的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]的更多相关文章
- centos上安装python环境
1.安装python-pip 首先安装epel扩展源: yum -y install epel-release 更新完成之后,安装pip: yum -y install python- ...
- 在CentOS上安装Python
首先我们需要在服务器上安装一个比较新的 Python,CentOS 5.8 默认装的 Python 是 2.4.3. [root@nowamagic ~]# python -V Python 我们需要 ...
- centos下安装python
下载网址:http://ftp.gnu.org/gnu/gdb/ 1.编译python必须安装开发工具 # yum groupinstall "Development tools" ...
- centos 7安装python 3
linux-Centos7安装python3并与python2共存 1.查看是否已经安装Python CentOS 7.2 默认安装了python2.7.5 因为一些命令要用它比如yum 它使用的 ...
- centos下 安装python相关
centos 安装python相关 python3 https://blog.csdn.net/tanxiaob/article/details/78725301 yum -y install zli ...
- centos如何安装python库?
通过yum install安装,先解决yum不能安装python库的问题 yum install -y epel-release #先安装epel源,参考http://sharadchhetri. ...
- centos 7 安装python 3.x
首先 安装一些 可能需要的依赖: yum -y groupinstall "Development tools" yum -y install zlib-devel bzip2-d ...
- CentOS 6 安装 python and pip
yum update yum list python* //查看可安装python包 yum install python34.i686_64 wget https://bootstrap.p ...
- Centos下安装Python的问题汇总
Python下载地址(https://www.python.org/ftp/python/) 一.工具安装 1.Python的安装 tar vxf Python-2.7.13.tgz cd Pytho ...
随机推荐
- atitit.重装系统需要备份的资料总结 o84..
atitit.重装系统需要备份的资料总结 o84.. 这里我的系统装在C盘..所以需要备份C盘的东西就好了.. 1.DESKTOP,这个目录要备份.如果重要资料 2.docume nt,这个需要..W ...
- paip.web数据绑定 下拉框的api设计 选择框 uapi python .net java swing jsf总结
paip.web数据绑定 下拉框的api设计 选择框 uapi python .net java swing jsf总结 ====总结: 数据绑定下拉框,Uapi 1.最好的是默认绑定..Map(k ...
- 文件系统:Ext3和Ext4
一.ext3和ext4的区别: 1.与Ext3兼容:执行若干条命令,就能将Ext3在线迁移到Ext4,而无须重新格式化磁盘或者重新安装系统.原有Ext3数据结构照样保留, Ext4作用于新数据,当然, ...
- 接入多家ERP厂商,美团点评餐饮高速路开启
前段时间美团点评CEO王兴所提出的中国互联网进入下半场观点引发了互联网从业人士以及网友们的热议.当时王兴提出,当前国内外所有的互联网公司包括美团点评在内都还远没有做好整个产业链的服务,美团点评也只做了 ...
- java历史集合类对比
- javaweb学习总结(四)——Http协议
一.什么是HTTP协议 HTTP是hypertext transfer protocol(超文本传输协议)的简写,它是TCP/IP协议的一个应用层协议,用于定义WEB浏览器与WEB服务器之间交换数据的 ...
- PowerManager和WakeLock的操作步骤
① PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);通过 Context.getSystemServ ...
- javascript设计模式与开发实践阅读笔记(6)——代理模式
代理模式:是为一个对象提供一个代用品或占位符,以便控制对它的访问. 代理模式的关键是,当客户不方便直接访问一个对象或者不满足需要的时候,提供一个替身对象来控制对这个对象的访问,客户实际上访问的是替身对 ...
- 常用基础OC 集合
// 2016年07月19日17:50:53 集合 //七.NSSet 集合对象(容器类,) // 1. 使用类方法创建对象 NSSet *set1 = [NSSet set]; // ...
- Anywhere服务建立及连接步骤
<烟叶自动化收购管理系统(山东版)>服务端程序为<烟站综合管理系统5.0>,5.0使用的数据库为Anywhere,设置方法如下: 建立anywhere服务连接步骤 服务 ...