新手问题 求助 CentOS tesseract-ocr 的问题

leoliran · 2016年04月28日 · 最后由 leoliran 回复于 2017年01月10日 · 4101 次阅读

系统环境 centos

Linux 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

ruby 版本

ruby -v ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-linux]

rails Rails 4.1.9

rails s

There was an error while trying to load the gem 'tesseract-ocr'. (Bundler::GemRequireError)
  /root/.rvm/gems/ruby-2.1.3/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require'
  /root/.rvm/gems/ruby-2.1.3/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
  /root/.rvm/gems/ruby-2.1.3/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
  /root/.rvm/gems/ruby-2.1.3/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
  /root/.rvm/gems/ruby-2.1.3/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
  /root/.rvm/gems/ruby-2.1.3/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
  /root/.rvm/gems/ruby-2.1.3/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
  /www/xxx/config/application.rb:14:in `<top (required)>'
  /www/xxx/config/environment.rb:2:in `require'
  /www/xxx/config/environment.rb:2:in `<top (required)>'
  config.ru:3:in `require'
  config.ru:3:in `block in <main>'
  /root/.rvm/gems/ruby-2.1.3/gems/rack-1.5.5/lib/rack/builder.rb:55:in `instance_eval'
  /root/.rvm/gems/ruby-2.1.3/gems/rack-1.5.5/lib/rack/builder.rb:55:in `initialize'
  config.ru:1:in `new'
  config.ru:1:in `<main>'
  /root/.rvm/gems/ruby-2.1.3/gems/passenger-5.0.27/src/helper-scripts/rack-preloader.rb:110:in `eval'
  /root/.rvm/gems/ruby-2.1.3/gems/passenger-5.0.27/src/helper-scripts/rack-preloader.rb:110:in `preload_app'
  /root/.rvm/gems/ruby-2.1.3/gems/passenger-5.0.27/src/helper-scripts/rack-preloader.rb:156:in `<module:App>'
  /root/.rvm/gems/ruby-2.1.3/gems/passenger-5.0.27/src/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
  /root/.rvm/gems/ruby-2.1.3/gems/passenger-5.0.27/src/helper-scripts/rack-preloader.rb:29:in `<main>'

tesseract -v

tesseract 3.04.00
 leptonica-1.72
  libgif 4.1.6(?) : libjpeg 6b (libjpeg-turbo 1.2.1) : libpng 1.2.49 : libtiff 3.9.4 : zlib 1.2.3 : libwebp 0.4.3

nginx 的配置

passenger_root /root/.rvm/gems/ruby-2.1.3/gems/passenger-5.0.27;
passenger_ruby /root/.rvm/gems/ruby-2.1.3/wrappers/ruby;

求遇到过该问题的大神提供火力支援

问题已解决 解决方案

移除之前已经安装的 libtesseract 和 libleptonica

yum remove  libtesseract libleptonica

安装 leptonica-devel tesseract-devel

For debian based systems
sudo apt-get install libleptonica-dev libtesseract-dev

For redhat base systems

sudo yum insall leptonica-devel tesseract-devel

错误处理:Unable to load library 'tesseract': libtesseract.so: cannot open shared object file: No such file or directory

export LD_LIBRARY_PATH=/usr/local/lib

相关资料

Error setting up the tesseract OCR in gem in rails github issue centos 编译安装 tesseract Leptonica ruby-tesseract-ocr

#3 楼 @leoliran

brew install leptonica-devel 我这边安装的时候为什么找不到呀 Error: No available formula with the name "leptonica-devel" ==> Searching for similarly named formulae... Error: No similarly named formulae found. ==> Searching taps... Error: No formulae found in taps.

需要 登录 后方可回复, 如果你还没有账号请 注册新账号