Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 如何解决;tesseract:加载共享库时出错:libpng12.so.0:无法打开共享对象文件:没有这样的文件或目录?_Ruby_Heroku_Tesseract - Fatal编程技术网

Ruby 如何解决;tesseract:加载共享库时出错:libpng12.so.0:无法打开共享对象文件:没有这样的文件或目录?

Ruby 如何解决;tesseract:加载共享库时出错:libpng12.so.0:无法打开共享对象文件:没有这样的文件或目录?,ruby,heroku,tesseract,Ruby,Heroku,Tesseract,当我在Rails应用程序中使用Heroku 18堆栈处理图像时: path = File.expand_path('app/assets/images/chicken_adobo_recipe.jpg') # => "/app/app/assets/images/chicken_adobo_recipe.jpg" image = RTesseract.new(path) # => #<RTesseract:0x000055e949fc9120 @source="/app/app

当我在Rails应用程序中使用Heroku 18堆栈处理图像时:

path = File.expand_path('app/assets/images/chicken_adobo_recipe.jpg')
# => "/app/app/assets/images/chicken_adobo_recipe.jpg"
image = RTesseract.new(path)
# => #<RTesseract:0x000055e949fc9120 @source="/app/app/assets/images/chicken_adobo_recipe.jpg", @config=#<RTesseract::Configuration command="tesseract", debug_file="/dev/null">, @errors=[]>
text = image.to_s
为了确保这不仅仅是一个RTesseract gem问题,我运行了以下命令,并且使用tesseract得到了或多或少相同的错误:

heroku run tesseract app/assets/images/chicken_adobo_recipe.jpg public/output
我的问题是:为什么我会遇到这个错误?这个错误意味着什么?还有,如何解决这个错误,以便使用tesseract解析图像中的文本

这是我的Aptfile:

tesseract-ocr
tesseract-ocr-eng
这是我的档案:

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.6.5'

gem 'rails', '~> 6.0.1'
gem 'puma', '~> 4.1'
gem 'sass-rails', '>= 6'
gem 'webpacker', '~> 4.0'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.7'
gem 'bootsnap', '>= 1.4.2', require: false
gem 'haml', '~> 5.0', '>= 5.0.4'
gem 'pg', '1.2.3'
gem 'rtesseract', '3.1'
gem "wkhtmltoimage-binary", "0.12.4"

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  gem 'awesome_print'
end

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

group :test do
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '>= 2.15'
  gem 'selenium-webdriver'
  # Easy installation and use of web drivers to run system tests with browsers
  gem 'webdrivers'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
源代码'https://rubygems.org'
git|u源(:github){| repo |“https://github.com/#{repo}.git}
ruby“2.6.5”
gem'rails',“~>6.0.1”
宝石“彪马”,“~>4.1”
gem'sass rails','>=6'
gem'webpacker',“~>4.0”
gem“涡轮链接”,“大于5”
gem'jbuilder',“~>2.7”
gem'bootsnap','>=1.4.2',require:false
gem'haml',“~>5.0',”>=5.0.4'
gem‘pg’、‘1.2.3’
gem“rtesseract”,“3.1”
gem“WKHTMLOTIMAGE二进制”、“0.12.4”
小组:开发,:测试
#在代码中的任意位置调用“byebug”以停止执行并获得调试器控制台
gem'byebug',平台:[:mri,:mingw,:x64_mingw]
宝石“绝妙印花”
终止
小组:发展怎么办
#在异常页面上或通过调用代码中的任意位置的“控制台”访问交互式控制台。
gem“web控制台”,“>=3.3.0”
gem'listen','>=3.0.5','<3.2'
#Spring通过让应用程序在后台运行来加速开发。阅读更多:https://github.com/rails/spring
宝石“春天”
gem‘SpringWatcherListen’,“~>2.0.0”
终止
组:测试do
#增加了对Capybara系统测试和selenium驱动程序的支持
gem‘水豚’,“>=2.15”
gem“selenium webdriver”
#轻松安装和使用web驱动程序以使用浏览器运行系统测试
gem“webdrivers”
终止
#Windows不包括zoneinfo文件,因此捆绑tzinfo数据
gem'tzinfo data',平台:[:mingw,:mswin,:x64_mingw,:jruby]

好的,我想出来了。为了解决这个问题并继续使用heroku 18堆栈,我必须选择一个heroku,它安装了Tesseract的更新版本——4.0

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.6.5'

gem 'rails', '~> 6.0.1'
gem 'puma', '~> 4.1'
gem 'sass-rails', '>= 6'
gem 'webpacker', '~> 4.0'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.7'
gem 'bootsnap', '>= 1.4.2', require: false
gem 'haml', '~> 5.0', '>= 5.0.4'
gem 'pg', '1.2.3'
gem 'rtesseract', '3.1'
gem "wkhtmltoimage-binary", "0.12.4"

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  gem 'awesome_print'
end

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

group :test do
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '>= 2.15'
  gem 'selenium-webdriver'
  # Easy installation and use of web drivers to run system tests with browsers
  gem 'webdrivers'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]