需要安装:

<span style="font-family:'Microsoft YaHei';font-size:14px;">
apt-get install autoconf
apt-get install automake
apt-get install libtool

</span>
-------------------------------------------------------------------------------------------------------------------------------------
安装过程,参考以下:

安装依赖包
sudo apt-get install autoconf automake libtool
sudo apt-get install libpng12-dev
sudo apt-get install libjpeg62-dev
sudo apt-get install libtiff4-dev
sudo apt-get install zlib1g-dev
sudo apt-get install libicu-dev # (if you plan to make the training tools)
sudo apt-get install libpango1.0-dev # (if you plan to make the training tools)
sudo apt-get install libcairo2-dev # (if you plan to make the training tools)
--------------------------------------------------------------------------
安装leptonica
tesseract依赖于leptonica,所以首先要下载安装leptonica
第一步:tar zxvf leptonica-1.73.tar.gz

第二步:cd leptonica-1.73

第三步:./configure --prefix=/usr/local/leptonica

第四步:make

第五步:make install

安装完成之后,配置环境变量,

gedit /etc/bash.bashrc

在文件末尾,添加环境变量的配置

PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/leptonica/lib/pkgconfig
export PKG_CONFIG_PATH
CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/local/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

source /etc/bash.bashrc

gedit /etc/ld.so.conf

在文件末尾,添加

/usr/local/leptonica/lib

source /etc/ld.so.conf

----------------------------------------------------------------------------------------------------------------------------

下载tesseract.

第一步:unzip tesseract

第二步:cd tesseract

第三步:./autogen.sh   如果不报错

第四步:LIBLEPT_HEADERSDIR=/usr/local/leptonica/include/leptonica ./configure --prefix=/usr/local/tesseract --with-extra-libraries=/usr/local/leptonica/lib   【注意:tesseract依赖于leptonica】

第五步:make

第六步:make install

第七步:make training

第八步: sudo make training-install  【注意:是training-install,不是 training install】

安装完后

 

 

 

添加环境变量PATH,否则,需要每次到安装路径运行。

第九步:gedit /etc/bash.bashrc,末尾添加

PATH=$PATH:/usr/local/tesseract/bin

export PATH

第十步:source /etc/bash.bashrc

------------------------------------------------------------------------------------------------------------------------------------------------------

然后,打开终端

 


---------------------
作者:Captain_zp
来源:CSDN
原文:https://blog.csdn.net/zhangping1987/article/details/51151050
版权声明:本文为博主原创文章,转载请附上博文链接!

 

 

 

tesseract编译错误:fatal error: allheaders.h: No such file or directory

 

错误描述:

globaloc.cpp:25:33: fatal error: allheaders.h: No such file or directory  

#include          "allheaders.h"

解决办法:

1、确认是否安装了leptonica

2、配置环境变量

 

复制代码
vi /etc/profile

添加:
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
 
source /etc/profile 
复制代码

 

如果仍然无法解决,参考以下文章重新安装:

http://www.cnblogs.com/rouge/p/7275391.html