Linux centos安装tesseract-ocr教程
安装依赖
依赖的包: autoconf automake libtool libjpeg-devel libpng-devel libtiff-devel zlib-devel leptonica(1.67以上)(一下环境依赖,有则更新,无则安装)
yum install autoconf automake libtool
yum install libjpeg-devel libpng-devel libtiff-devel zlib-devel
Leptonica 库安装 自行下载 百度云链接: https://pan.baidu.com/s/1RAP6hFOEu6zEKIgi__1Ngw?pwd=gpvr 提取码: gpvr
# 解压 tar -zxvf 你版本的压缩文件名 # 进入包文件夹 cd 你解压后的文件名 # 依次执行以下命令,进行程序编译,安装 ./autogen.sh ./configure make make install
leptonica添加环境变量
# 修改profile vim /etc/profile # 添加信息 i export LD_LIBRARY_PATH=/usr/local/lib export LIBLEPT_HEADERSDIR=/usr/local/include export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig # 保存 Esc =》:wq! # 刷新配置 source /etc/profile
安装Tesseract-OCR 自行下载tesseract 百度云链接: https://pan.baidu.com/s/1RAP6hFOEu6zEKIgi__1Ngw?pwd=gpvr 提取码: gpvr
tar -xzvf tesseract-5.2.0.tar.gz cd tesseract-5.2.0 ./autogen.sh ./configure make make install
tesseract 添加到环境变量
vim /etc/profile # 添加以下字段: PATH=$PATH:/usr/local/tesseract/bin export PATH export TESSDATA_PREFIX=/root/tessdata export PATH=$PATH:$TESSDATA_PREFIX # 刷新配置 source /etc/profile
CentOS编译安装tesseract时错误 (Your compiler does not have the necessary C++17 support!), 需要升级GCC版本
执行命令:
yum install -y centos-release-scl yum install devtoolset-8-gcc*
切换当前会话中gcc版本为8
scl enable devtoolset-8 bash
查看tesseract基本信息
# 查看tesseract版本 tesseract --version # 查看可执行文件路径: which tesseract /usr/local/bin/tesseract # 当前语言包的路径(如果你下载了语言包,丢到这里): /usr/local/share/tessdata
添加语言包支持