前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >centos7 yum 安装 tesseract pip 安装 python3 tesserocr

centos7 yum 安装 tesseract pip 安装 python3 tesserocr

作者头像
拓荒者
发布2019-03-11 11:04:38
1.2K0
发布2019-03-11 11:04:38
举报
文章被收录于专栏:运维经验分享运维经验分享

#安装epel 源:

代码语言:javascript
复制
yum -y install epel-release

#安装tesseract:

代码语言:javascript
复制
yum -y install tesseract

#执行检查tesseract 支持的语言:

代码语言:javascript
复制
tesseract --list-langs

List of available languages (1): eng

发现目前只支持英语,要安装更多语言包可执行git 获取:

代码语言:javascript
复制
  1. git clone https://github.com/tesseract-ocr/tessdata.git
  2. mv tessdata/* /usr/share/tesseract/tessdata

pip 安装 pillow 和 tesserocr:

代码语言:javascript
复制
pip3 install pillow tesserocr

发现安装 pillow 成功,tesserocr 报错了

Installing collected packages: tesserocr   Running setup.py install for tesserocr ... error     Complete output from command /usr/local/python3/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-i48iarbe/tesserocr/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-p27b42h9/install-record.txt --single-version-externally-managed --compile:     pkg-config failed to find tesseract/lept libraries: b"Package tesseract was not found in the pkg-config search path.\nPerhaps you should add the directory containing `tesseract.pc'\nto the PKG_CONFIG_PATH environment variable\nNo package 'tesseract' found\n"     Supporting tesseract v3.04.00     Building with configs: {'libraries': ['tesseract', 'lept'], 'cython_compile_time_env': {'TESSERACT_VERSION': 197632}}     /usr/local/python3/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'       warnings.warn(msg)     running install     running build     running build_ext     building 'tesserocr' extension     creating build     creating build/temp.linux-x86_64-3.6     gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/python3/include/python3.6m -c tesserocr.cpp -o build/temp.linux-x86_64-3.6/tesserocr.o     tesserocr.cpp:597:34: fatal error: leptonica/allheaders.h: No such file or directory      #include "leptonica/allheaders.h"                                       ^     compilation terminated.     error: command 'gcc' failed with exit status 1     ---------------------------------------- Command "/usr/local/python3/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-i48iarbe/tesserocr/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-p27b42h9/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-i48iarbe/tesserocr/

#解决方法,安装一下 tesseract-devel 库:

代码语言:javascript
复制
yum install tesseract-devel 

#再重新pip安装tesserocr:

代码语言:javascript
复制
pip3 install tesserocr

没报错,完成!

(adsbygoogle = window.adsbygoogle || []).push({});

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018/09/10 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
AI 应用产品
文字识别(Optical Character Recognition,OCR)基于腾讯优图实验室的深度学习技术,将图片上的文字内容,智能识别成为可编辑的文本。OCR 支持身份证、名片等卡证类和票据类的印刷体识别,也支持运单等手写体识别,支持提供定制化服务,可以有效地代替人工录入信息。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档