下载
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
安装依赖:yum install autoconf automake libtool libjpeg-devel libpng-devel libtiff-devel zlib-devel
安装leptonica
tar -xzvf leptonica-1.74.4.tar.gz
cd leptonica-1.74.4.tar.gz
./configure --profix=/usr/local/leptonica
make
sudo make install
很多其他教程到这一步就直接开始安装 tesseract,实际上如果你照着教程走的话,再 configure 的时候就会报错:找不到 leptonica。所以我们要先配置一下 leptonica 的环境变量。
打开 /etc/profile
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
OK,现在我们就可以开始安装 tesseract。
安装 tesseract
tar -xzvf 4.1.0.tar.gz
cd tesseract-4.1.0
./configure --profix=/usr/local/tesseract
make
sudo make install
接下来配置 tesseract 环境变量
打开 /etc/profile
vim /etc/profile
追加以下字段
PATH=$PATH:/usr/local/tesseract/bin
export PATH
应用配置
source /etc/profile
测试一下:
tesseract -v
输出:
tesseract 4.1.0
leptonica-1.74.4
libjpeg 6b (libjpeg-turbo 1.2.90) : libpng 1.5.13 : libtiff 4.0.3 : zlib 1.2.7
Found AVX2
Found AVX
Found SSE
OK,到这里,我们就安装成功了,你的安装成功了吗?有任何问题评论告诉我吧!
来源:oschina
链接:https://my.oschina.net/u/4318872/blog/4390448