如何解决 Ruby on Rails ImageMagick 冲突?

如何解决 Ruby on Rails ImageMagick 冲突?

我正在尝试安装炼油厂CMS,Ubuntu 10.04 LTS 上的 Ruby on Rails CMS。我运行rails server它时出现以下异常:

carcher@carcher-laptop:~/Code/tgc$ rails server
=> Booting WEBrick
=> Rails 3.0.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/usr/lib/ruby/gems/1.8/gems/rmagick-2.12.2/lib/RMagick2.so: This installation of RMagick was configured with ImageMagick 6.6.4 but ImageMagick 6.5.7-8 is in use. (RuntimeError)
 from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
 from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `load_dependency'
 from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:591:in `new_constants_in'
 from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `load_dependency'
 from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
 from /usr/lib/ruby/gems/1.8/gems/rmagick-2.12.2/lib/RMagick.rb:11
 from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
 from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
 from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `load_dependency'
 from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:591:in `new_constants_in'
 from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `load_dependency'
 from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
 from /usr/lib/ruby/gems/1.8/gems/dragonfly-0.7.6/lib/dragonfly/analysis/r_magick_analyser.rb:1
 from /usr/lib/ruby/gems/1.8/gems/dragonfly-0.7.6/lib/dragonfly/config/r_magick.rb:15:in `apply_configuration'
 from /usr/lib/ruby/gems/1.8/gems/dragonfly-0.7.6/lib/dragonfly/configurable.rb:33:in `configure'
 from /usr/lib/ruby/gems/1.8/gems/dragonfly-0.7.6/lib/dragonfly/config/r_magick.rb:14:in `apply_configuration'
 from /usr/lib/ruby/gems/1.8/gems/dragonfly-0.7.6/lib/dragonfly/configurable.rb:39:in `configure_with'
 from /usr/lib/ruby/gems/1.8/gems/refinerycms-0.9.8.2/vendor/refinerycms/images/lib/images.rb:10
 from /usr/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/initializable.rb:25:in `instance_exec'
 from /usr/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/initializable.rb:25:in `run'
 from /usr/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/initializable.rb:50:in `run_initializers'
 from /usr/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/initializable.rb:49:in `each'
 from /usr/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/initializable.rb:49:in `run_initializers'
 from /usr/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/application.rb:134:in `initialize!'
 from /usr/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/application.rb:77:in `send'
 from /usr/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/application.rb:77:in `method_missing'
 from /home/carcher/Code/tgc/config/environment.rb:5
 from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
 from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
 from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `load_dependency'
 from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:591:in `new_constants_in'
 from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `load_dependency'
 from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
 from /home/carcher/Code/tgc/config.ru:3
 from /usr/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval'
 from /usr/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize'
 from /home/carcher/Code/tgc/config.ru:1:in `new'
 from /home/carcher/Code/tgc/config.ru:1
carcher@carcher-laptop:~/Code/tgc$ 

我按照说明从源代码构建并安装了 ImageMagick 6.6.4这里在此之前,我删除了 Ubuntu 中预装的 ImageMagick 工具,以避免任何冲突。但我似乎仍然有这个版本 6.5.7。

我想我的问题是如何删除/禁用ImageMagick 6.5.7-8

答案1

如果您在软件包列表中找不到 imagemagick 6.5.7,则可能是您将其安装到了 /usr/local。

尝试which convert查看 imagemagick 二进制文件的位置。(convert是 imagemagick 附带的实用程序之一。)还尝试convert --version查看哪个版本处于活动状态。如果您获得的版本与 Ruby/Rails 看到的版本不同,请检查您的项目配置以确保您没有它可能正在查找的任何额外路径。此外,请确保 imagemagick 未安装到您的 Rails 应用程序目录中;我认为它也可能尝试在那里包含内容。

答案2

我已经启动并运行!解决方案已发布这里在 Stack Overflow 上。

相关内容