tesseract 4.0 编译安装(CentOS)

1、安装依赖工具
yum install autoconf automake libtool libjpeg-devel libpng-devel libtiff-devel zlib-devel

 

2、编译安装leptonica
wget http://www.leptonica.org/source/leptonica-1.74.4.tar.gz
tar zxvf leptonica-1.74.4.tar.gz leptonica-1.74.4
cd leptonica-1.74.4/
./configure --prefix=/usr/local/leptonica
make
make install

 

 3、配置环境变量
vi /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

 

4、编译安装tesseract
git clone https://github.com/tesseract-ocr/tesseract.git
cd tesseract
./autogen.sh
./configure --prefix=/usr/local/tesseract --with-extra-libraries=/usr/local/leptonica/lib   
make
make install
make training
make training-install
 
5、配置环境变量
vi /etc/profile
 
添加:
PATH=$PATH:/usr/local/tesseract/bin
export PATH
 
source /etc/profile 

 

6、测试安装是否成功

tesseract -v

显示:
tesseract 4.00.00alpha
 leptonica-1.74.4
  libgif 4.1.6(?) : libjpeg 6b (libjpeg-turbo 1.2.90) : libpng 1.5.13 : zlib 1.2.7 : libwebp 0.3.0

 Found SSE

 

posted @ 2017-08-02 18:31  牛肉哥  阅读(3856)  评论(1编辑  收藏  举报