我的Rmagic不起作用
ruby -v
ruby 1.8.7(2010-01-10 patchlevel 249)[i386-mingw32]
rails -v
Rails 3.0.0.beta4
IRB
需要rubygems
真
需要rmagick
真
但是,我把fllow代码:
gem'rmagick',:require =>假
它错误:
checking for Ruby version >= 1.8.5... yes checking for stdint.h... no checking for sys/types.h... no checking for wand/MagickWand.h... no Can't install RMagick 2.13.1. Can't find MagickWand.h. *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=C:/Ruby/bin/ruby Gem files will remain installed in C:/Ruby/lib/ruby/gems/1.8/gems/rmagick-2.13.1 for inspection. Results logged to C:/Ruby/lib/ruby/gems/1.8/gems/rmagick-2.13.1/ext/RMagick/gem_make.out from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/installer.rb:446:in `each' from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/installer.rb:446:in `build_extensions' from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/installer.rb:198:in `install' from C:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/source.rb:100:in `install' from C:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/installer.rb:55:in `run' from C:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/spec_set.rb:12:in `each' from C:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/spec_set.rb:12:in `each' from C:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/installer.rb:44:in `run' from C:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/installer.rb:8:in `install' from C:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/cli.rb:217:in `install' from C:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/task.rb:22:in `send' from C:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/task.rb:22:in `run' from C:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/invocation.rb:118:in `invoke from C:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor.rb:246:in `dispatch' from C:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/base.rb:389:in `start' from C:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.0/bin/bundle:13 from C:/Ruby/bin/bundle:19:in `load' from C:/Ruby/bin/bundle:19
请帮助我,谢谢!
答案 0 :(得分:2)
MagickWand.h是ImageMagick的一部分,RMagick安装程序无法找到它。您似乎需要在系统上安装ImageMagick,或者如果安装了ImageMagick,则需要将库添加到gem安装程序可以看到的路径中。如果没有在系统上安装ImageMagick或GraphicsMagick,RMagick将无法运行。
更新的答案 由于您使用的是Windows,因此需要手动下载gem并进行安装。安装常见问题解答说:
使用rmagick-win32 gem。此gem与ImageMagick Windows安装程序的副本捆绑在一起,因此您无需下载自己的副本。从RubyForge上的RMagick项目页面下载rmagick-win32 gem,将其解压缩到一个临时目录中,并按照包中找到的README.html文件中的说明进行操作。
http://rubyforge.org/projects/rmagick/
我想您可能想要卸载已安装的imagemagick版本,以防出现任何冲突。手动安装gem后,您应该可以将它放在Gemfile中并捆绑安装。没有在windows上使用rmagick,我不确定你是否将gem引用为“rmagick”或“rmagick-win32”。手动安装gem后,您可以通过运行“gem list”命令来解决这个问题。查看哪一个出现并将其放入您的Gemfile中,以便它可以找到已安装的版本.Bundler将使用此gem而不是尝试安装新的。
答案 1 :(得分:-1)
这段代码可以解决问题...
require 'RMagick'
不 require 'rmagick'