提示RMagick過時,請使用rmagick的問題

故障描述

  客戶某軟件rmagick無法使用;提示: [DEPRECATION] requiring "RMagick" is deprecated. Use "rmagick" instead

故障分析

  無

處理過程

gem list rmagick

*** LOCAL GEMS ***

rmagick (2.16.0)

============

irb
irb(main):001:0> nil
=> nil
irb(main):002:0> puts "defined" if Object.const_defined?(:Magick)
=> nil
irb(main):003:0>  require 'rmagick'
LoadError: libMagickWand-6.Q16.so.2: cannot open shared object file: No such file or directory - /data/ruby/lib/ruby/gems/2.3.0/gems/rmagick-2.16.0/lib/RMagick2.so
        from /data/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in `require'
        from /data/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
        from /data/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
        from /data/ruby/lib/ruby/gems/2.3.0/gems/rmagick-2.16.0/lib/rmagick_internal.rb:12:in `<top (required)>'
        from /data/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /data/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /data/ruby/lib/ruby/gems/2.3.0/gems/rmagick-2.16.0/lib/rmagick.rb:1:in `<top (required)>'
        from /data/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in `require'
        from /data/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
        from /data/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
        from (irb):3
        from /data/ruby/bin/irb:11:in `<main>'

========================提示找不到庫文件===========

查找庫文件

find / -name libMagickWand-6.Q16.so.2
/usr/local/lib/libMagickWand-6.Q16.so.2

=========================

ldconfig /usr/local/lib

irb
irb(main):001:0> puts "defined" if Object.const_defined?(:Magick)
=> nil
irb(main):002:0> require 'rmagick'
=> true
irb(main):003:0> puts "defined" if Object.const_defined?(:Magick)
defined
=> nil
irb(main):004:0> quit

=================問題解決。

建議/總結

  無

中国6一12呦女精品