码迷,mamicode.com
首页 > 其他好文 > 详细

tesseract安装(CentOS)

时间:2021-06-07 20:42:37      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:ret   oca   mpi   arc   git   生效   jpeg   sha   oge   

tesseract安装(CentOS)

1.安装图片相关依赖

yum install autoconf automake libtool libjpeg-devel libpng-devel libtiff-devel zlib-devel

2.下载

wget https://github.com/tesseract-ocr/tesseract/archive/4.1.0.tar.gz
wget http://www.leptonica.org/source/leptonica-1.74.4.tar.gz	

3.安装leptonica(tesseract 依赖 leptonica)

tar -xzvf leptonica-1.74.4.tar.gz
cd leptonica-1.74.4
./configure --prefix=/usr/local/leptonica
make
sudo make install

4.配置 leptonica 环境变量

vim /etc/profile

添加

PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/leptonica/lib/pkgconfig
export PKG_CONFIG_PATH
CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/local/leptonica/include/leptonica
export CPLUS_INCLUDE_PATH
C_INCLUDE_PATH=$C_INCLUDE_PATH:/usr/local/leptonica/include/leptonica
export C_INCLUDE_PATH
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/leptonica/lib
export LD_LIBRARY_PATH
LIBRARY_PATH=$LIBRARY_PATH:/usr/local/leptonica/lib
export LIBRARY_PATH
LIBLEPT_HEADERSDIR=/usr/local/leptonica/include/leptonica
export LIBLEPT_HEADERSDIR

使配置生效

source /etc/profile

5.安装 tesseract

tar -xzvf tesseract-4.1.0.tar.gz
cd tesseract-4.1.0
./autogen.sh
./configure --prefix=/usr/local/tesseract
make
sudo make install

若报错,说明缺少 c++ 编译器

checking for g++... no
checking for clang++... no
checking whether the C++ compiler works... no
configure: error: in `/usr/mydownload/tesseract-4.1.0‘:
configure: error: C++ compiler cannot create executables
See `config.log‘ for more details

yum install gcc gcc-c++

6.配置 tesseract 环境变量

vim /etc/profile

添加

PATH=$PATH:/usr/local/tesseract/bin
export PATH
export TESSDATA_PREFIX="/usr/local/tesseract/share/tessdata" 
export PATH=$PATH:$TESSDATA_PREFIX

使配置生效

source /etc/profile

7.测试是否安装成功

tesseract -v

8.上传语言包到 /usr/local/tesseract/share/tessdata/ 目录下

tesseract安装(CentOS)

标签:ret   oca   mpi   arc   git   生效   jpeg   sha   oge   

原文地址:https://www.cnblogs.com/SetariaViridis/p/14858523.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!