我试图制作一个OCR应用程序,然后将gem添加到gemfile" tesseract-ocr"运行服务器时,它显示以下错误:
/Users/brijesh/.rvm/gems/ruby-2.2.1/gems/ffi-1.9.10/lib/ffi/library.rb:133:in `block in ffi_lib': Could not open library '/var/folders/1z/tn3pp1b90fvb5dh_7t2_kt2c0000gn/T/.ffi-inline-501/55a18292181116dcb44d5cd16f74500e379c7f92.dylib': dlopen(/var/folders/1z/tn3pp1b90fvb5dh_7t2_kt2c0000gn/T/.ffi-inline-501/55a18292181116dcb44d5cd16f74500e379c7f92.dylib, 5): Library not loaded: /usr/local/lib/libjpeg.8.dylib (LoadError)
Referenced from: /usr/local/lib/liblept.4.dylib
Reason: Incompatible library version: liblept.4.dylib requires version 13.0.0 or later, but libjpeg.8.dylib provides version 12.0.0
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/ffi-1.9.10/lib/ffi/library.rb:100:in `map'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/ffi-1.9.10/lib/ffi/library.rb:100:in `ffi_lib'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/ffi-inline-0.0.4.3/lib/ffi/inline/builders.rb:90:in `block in build'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/ffi-inline-0.0.4.3/lib/ffi/inline/builders.rb:87:in `instance_eval'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/ffi-inline-0.0.4.3/lib/ffi/inline/builders.rb:87:in `build'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/ffi-inline-0.0.4.3/lib/ffi/inline/inline.rb:54:in `singleton_inline'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/ffi-inline-0.0.4.3/lib/ffi/inline/inline.rb:39:in `inline'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/tesseract-ocr-0.1.8/lib/tesseract/c.rb:34:in `<module:C>'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/tesseract-ocr-0.1.8/lib/tesseract/c.rb:31:in `<module:Tesseract>'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/tesseract-ocr-0.1.8/lib/tesseract/c.rb:29:in `<top (required)>'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/tesseract-ocr-0.1.8/lib/tesseract/api.rb:26:in `require'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/tesseract-ocr-0.1.8/lib/tesseract/api.rb:26:in `<top (required)>'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/tesseract-ocr-0.1.8/lib/tesseract-ocr.rb:35:in `require'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/tesseract-ocr-0.1.8/lib/tesseract-ocr.rb:35:in `<top (required)>'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/bundler-1.10.6/lib/bundler.rb:134:in `require'
from /Users/brijesh/Desktop/project/nepal-receipt-processing-2/config/application.rb:15:in `<top (required)>'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:79:in `require'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:79:in `block in server'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:76:in `tap'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:76:in `server'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/commands.rb:17:in `<top (required)>'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/app_rails_loader.rb:43:in `require'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/app_rails_loader.rb:43:in `block in exec_app_rails'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/app_rails_loader.rb:32:in `loop'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/app_rails_loader.rb:32:in `exec_app_rails'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/cli.rb:5:in `<top (required)>'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/bin/rails:9:in `require'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/bin/rails:9:in `<top (required)>'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/bin/rails:23:in `load'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/bin/rails:23:in `<main>'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `eval'
from /Users/brijesh/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `<main>'
我在互联网上搜索了很多,但找不到解决方案。我非常感谢你的帮助。
答案 0 :(得分:3)
实际上问题是在mac上安装了tesseract,安装了tesseract-ocr gem已经失去兼容性的当前版本。
The solution in this answer显示了如何安装与当前(截至2016年5月)tesseract
gem
tesseract-ocr 0.1.8
brew install https://raw.githubusercontent.com/Homebrew/homebrew/8ba134eda537d2cee7daa7ebdd9f728389d9c53e/Library/Formula/tesseract.rb