本文主要使用编译安装,yum安装未深入研究为何无法使用
一、下载依赖
sudo yum install -y gcc gcc-c++ make autoconf automake libtool pkgconfig
sudo yum install -y leptonica leptonica-devel
这里额外记录一下我踩的坑,第二个依赖安装的时候出现了一些状况
[root@ip-172-31-37-111 tesseract-5.2.0]# yum install -y leptonica leptonica-devel
Last metadata expiration check: 12:22:32 ago on Wed Jun 26 22:37:31 2024.
Package wget-1.21.3-1.amzn2023.0.3.x86_64 is already installed.
Error:
Problem 1: conflicting requests
- nothing provides libpng15.so.15()(64bit) needed by leptonica-1.72-2.el7.x86_64 from epel
- nothing provides libpng15.so.15(PNG15_0)(64bit) needed by leptonica-1.72-2.el7.x86_64 from epel
- nothing provides libgif.so.4()(64bit) needed by leptonica-1.72-2.el7.x86_64 from epel
- nothing provides libwebp.so.4()(64bit) needed by leptonica-1.72-2.el7.x86_64 from epel
Problem 2: package leptonica-devel-1.72-2.el7.x86_64 from epel requires leptonica(x86-64) = 1.72-2.el7, but none of the providers can be installed
- package leptonica-devel-1.72-2.el7.x86_64 from epel requires liblept.so.4()(64bit), but none of the providers can be installed
- conflicting requests
- nothing provides libpng15.so.15()(64bit) needed by leptonica-1.72-2.el7.x86_64 from epel
- nothing provides libpng15.so.15(PNG15_0)(64bit) needed by leptonica-1.72-2.el7.x86_64 from epel
- nothing provides libgif.so.4()(64bit) needed by leptonica-1.72-2.el7.x86_64 from epel
- nothing provides libwebp.so.4()(64bit) needed by leptonica-1.72-2.el7.x86_64 from epel
(try to add '--skip-broken' to skip uninstallable packages)
安装Leptonica依赖
没错,就是因为这里无法yum无法使用,我又一次选择了源码编译安装 ,需要注意的是,在使用ocr的时候需要Leptonica依赖版本超过1.74,所以可以先执行以下yum remove leptonica leptonica-devel删除依赖,如本机并无安装则忽略
wget https://github.com/DanBloomberg/leptonica/archive/refs/tags/1.82.0.tar.gz
tar -xzvf 1.82.0.tar.gz
cd leptonica-1.82.0
./autogen.sh