centos7安装Tesseract-OCR 4.1 报错 configure: error: Leptonica 1.74 or higher is required. 解决方法

在centos7安装Tesseract-OCR 4.1时,我们知道官网只给出了ubuntu的编译教程,在centos7上安装出现了很多问题,下面就是我遇到的问题

1、出现问题

我遇到的问题就是报错:

configure: error: Leptonica 1.74 or higher is required. 

2、解决方法

源码安装Leptonica-1.78,源码下载:http://www.leptonica.org/source/leptonica-1.78.0.tar.gz

因为官网是国外的,如果觉得下载有点慢,我已经提前下载好,下载地址:leptonica-1.78.0.tar.gz

# 用wget命令下载
wget -c -t 20 https://www.ivdone.top/wordpress/pic/p1538/leptonica-1.78.0.tar.gz

编译与安装:

先安装依赖,不然会报错:

yum install libjpeg-devel
yum install libpng-devel
yum install libtiff-devel
# 编译和安装
tar -zxvf leptonica-1.78.0.tar.gz
cd leptonica-1.78.0/
./configure --prefix=/usr/local/
make
make install 

配置环境变量:

# 配置环境变量
vi /etc/profile

往该文件中加入下面的环境变量并导出:

export LD_LIBRARY_PATH=$LD_LIBRARY_PAYT:/usr/local/lib
export LIBLEPT_HEADERSDIR=/usr/local/include
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

更新环境变量:

source /etc/profile

3、测试

重新进入tesseract-4.1.1目录

./autogen.sh
./configure --with-extra-includes=/usr/local/include --with-extra-libraries=/usr/local/include
make && make install
# 版本测试
tesseract -v

0

Leave a Reply

Your email address will not be published.