我在rails上使用ruby来运行一些OCR任务。我试图使用tesseract-ocr gem(https://github.com/meh/ruby-tesseract-ocr)。
在我的Gemfile中,如果tesseract-ocr gem列出如下:
gem 'tesseract-ocr'
我收到以下错误:
C:\Users\Redacted\Desktop\Rails\cx-master>rails c
The system cannot find the path specified.
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/runtime.rb:85:in
rescue in block (2 levels) in require': There was an error while trying to load the gem 'tesseract-ocr'. (Bundler::GemRequireError)
Gem Load Error is: compile error: see logs at C:/Users/Redacted_~1/AppData/Local/Temp/.ffi-inline-0/6a21dd7f0d1fcf6ba9de29522e4ac8d7604046d7.log
Backtrace for gem load error is:
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/ffi-inline-0.0.4.3/lib/ffi/inline/compilers/gcc.rb:35:in
compile'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/ffi-inline-0.0.4.3/lib/ffi/inline/builders/c.rb:114:in shared_object'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/ffi-inline-0.0.4.3/lib/ffi/inline/builders.rb:90:in
block in build'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/ffi-inline-0.0.4.3/lib/ffi/inline/builders.rb:87:in instance_eval'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/ffi-inline-0.0.4.3/lib/ffi/inline/builders.rb:87:in
build'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/ffi-inline-0.0.4.3/lib/ffi/inline/inline.rb:54:in singleton_inline'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/ffi-inline-0.0.4.3/lib/ffi/inline/inline.rb:39:in
inline'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/tesseract-ocr-0.1.8/lib/tesseract/c.rb:34:in <module:C>'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/tesseract-ocr-0.1.8/lib/tesseract/c.rb:31:in
'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/tesseract-ocr-0.1.8/lib/tesseract/c.rb:29:in <top (required)>'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/tesseract-ocr-0.1.8/lib/tesseract/api.rb:26:in
require'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/tesseract-ocr-0.1.8/lib/tesseract/api.rb:26:in <top (required)>'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/tesseract-ocr-0.1.8/lib/tesseract-ocr.rb:35:in
require'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/tesseract-ocr-0.1.8/lib/tesseract-ocr.rb:35:in <top (required)>'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/runtime.rb:82:in
require'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/runtime.rb:82:in block (2 levels) in require'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/runtime.rb:77:in
each'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/runtime.rb:77:in block in require'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/runtime.rb:66:in
each'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/runtime.rb:66:in require'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/lib/bundler.rb:108:in
require'
C:/Users/Redacted/Desktop/Rails/cx-master/config/application.rb:7:in <top (required)>'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/command/actions.rb:15:in
require'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/command/actions.rb:15:in require_application_and_environment!'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/console/console_command.rb:96:in
perform'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in run'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in
invoke_command'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in dispatch'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in
perform'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/command.rb:44:in invoke'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in
'
bin/rails:4:in require'
bin/rails:4:in
'
Bundler Error Backtrace:
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/runtime.rb:81:in block (2 levels) in require'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/runtime.rb:77:in
each'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/runtime.rb:77:in block in require'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/runtime.rb:66:in
each'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/runtime.rb:66:in require'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/lib/bundler.rb:108:in
require'
from C:/Users/Redacted/Desktop/Rails/cx-master/config/application.rb:7:in <top (required)>'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/command/actions.rb:15:in
require'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/command/actions.rb:15:in require_application_and_environment!'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/console/console_command.rb:96:in
perform'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in run'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in
invoke_command'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in dispatch'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in
perform'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/command.rb:44:in invoke'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in
'
from bin/rails:4:in require'
from bin/rails:4:in
'
(如果我删除了宝石,那么应用就可以了。)
安装了Tesseract:
rescue in block (2 levels) in require': There was an error while trying to load the gem 'tesseract-ocr'. (Bundler::GemRequireError)
Gem Load Error is: compile error: see logs at C:/Users/Redacted_~1/AppData/Local/Temp/.ffi-inline-0/6a21dd7f0d1fcf6ba9de29522e4ac8d7604046d7.log
Backtrace for gem load error is:
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/ffi-inline-0.0.4.3/lib/ffi/inline/compilers/gcc.rb:35:in
宝石也是如此:
shared_object'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/ffi-inline-0.0.4.3/lib/ffi/inline/builders.rb:90:in
路径也设定:
instance_eval'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/ffi-inline-0.0.4.3/lib/ffi/inline/builders.rb:87:in
singleton_inline'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/ffi-inline-0.0.4.3/lib/ffi/inline/inline.rb:39:in
问题的症结在于:虽然gesfile中列出了tesseract-ocr gem,但我无法运行该应用程序。我在第3天绕着这个错误绕圈而来,所以一双新鲜的眼睛&amp;非常感谢任何帮助。