How to compile tesseract 4.0 from source in UBUNTU 16.04

HOW to Install Tesseract 4.0 from source in Ubuntu 16.04

this is a tutorial :
remove old version tesseract:
1. sudo apt-get remove tesseract-ocr*
2. 

Configure compiling environment
sudo apt-get install -y build-essential &&\
sudo apt-get install -y python-dev &&\
sudo apt-get install -y python &&\
sudo apt-get install -y python-pip &&\
sudo apt-get install -y python-setuptools &&\
sudo pip install -y cython

you need to Upgrade g++5

sudo add-apt-repository ppa:ubuntu-toolchain-r/test &&\
sudo apt-get update &&\
sudo apt-get upgrade &&\
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5

Install dependency package

sudo apt-get install -y autoconf automake libtool &&\
sudo apt-get install -y autoconf-archive &&\
sudo apt-get install -y pkg-config &&\
sudo apt-get install -y libpng12-dev &&\
sudo apt-get install -y libjpeg8-dev &&\
sudo apt-get install -y libtiff5-dev &&\
sudo apt-get install -y zlib1g-dev &&\
sudo apt-get install -y libicu-dev &&\
sudo apt-get install -y libpango1.0-dev &&\
sudo apt-get install -y libcairo2-dev

Install Leptonica 1.74

Install it from source code

  1. Download the source code from Leptonica
  2. Following the instructions to install it.
    sudo tar xf leptonica-1.74.tar.gz &&\
    cd leptonica-1.74 &&\
    sudo ./configure &&\
    sudo make &&\
    sudo make install
    

Install it from Unofficial Ubuntu PPAs

sudo add-apt-repository ppa:alex-p/tesseract-ocr &&\
sudo apt-get update &&\
sudo apt-get install -y libleptonica-dev &&\
sudo ldconfig

Install Tesseract 4.0


  1. git clone tesseract from Github, and Checkout code from Github, --> git -b <your_brench_name>... 
  2. Compiling it and install it.
    sudo sh autogen.sh  &&\
    ./configure  &&\
    LDFLAGS="-L/usr/local/lib" CFLAGS="-I/usr/local/include" make  &&\
    sudo make install  &&\
    sudo make install -langs  &&\
    sudo ldconfig

if you got permission denied error in this step, maybe it would be you check out the github, so you can download zip file from github instead of git clone and checkout it.....


that's it....

留言

這個網誌中的熱門文章

【多益】現點現做的英文怎麼說呢?

《Microsoft Word 應用》:圖片被文字蓋住解決方法,不可設定為固定行高

如何在Ubuntu系統上安裝Notepad ++ (Install Notepad++ On Ubuntu 16.04 / 17.10 / 18.04 / 20.04)