首页 文章

Rmagic不适用于Rails3

提问于
浏览
2

我的Rmagic不起作用

红宝石-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 => false

它错误:

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

please help me , thanks !

2 回答

  • -1

    MagickWand.h是ImageMagick的一部分,RMagick安装程序找不到它 . 您似乎需要在系统上安装ImageMagick,或者如果安装了ImageMagick,则需要将库添加到gem安装程序可以看到的路径中 . 如果没有在系统上安装ImageMagick或GraphicsMagick,RMagick将无法运行 .

    UPDATED ANSWER 由于您使用的是Windows,因此需要手动下载gem并进行安装 . 安装FAQ说:

    使用rmagick-win32 gem . 此gem与ImageMagick Windows安装程序的副本捆绑在一起,因此您无需在包中找到 .

    http://rubyforge.org/projects/rmagick/

    我想你可能想要卸载已经安装的imagemagick版本,以防有任何冲突 . 手动安装gem后,您应该可以将它放在Gemfile中并捆绑安装 . 没有在windows上使用rmagick,我不确定你是否将gem引用为“rmagick”或“rmagick-win32” . 手动安装gem后,您可以通过运行“gem list”命令来解决这个问题 . 看看哪一个显示并将其放入您的Gemfile中,以便它可以找到已安装的版本.Bundler将使用此gem而不是尝试安装新的gem .

  • 2

    这段代码应该诀窍......

    require 'RMagick' not require 'rmagick'

相关问题