问题描述
我已经通过MacPorts在OSX上安装了RMagick,可以通过运行'gem server'来查看它。但是当我尝试将它包含在我的脚本中时使用
I have installed RMagick on OSX via MacPorts and can see it by running 'gem server'. However when I try to include it in my script using
require 'rubygems'
require 'RMagick'
它因以下错误消息而崩溃
It crashes with the following error message
./RMagick.rb:4:in `show_info': uninitialized constant Magick (NameError)
from ./RMagick.rb:24
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
from ./rmagick.rb:1
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
from get_pixels.rb:2
可能任何电话我,我做错了什么?
Could anyone tell me what I'm doing wrong?
推荐答案
我曾经创建了一个ImageResize工具,我刚刚检查了我是如何包含的在那里:
I have once created an ImageResize Tool and I just checked how I've included it there:
require 'rubygems'
require 'RMagick'
include Magick
我还有OS X并使用macports安装了RMagick。也许您还需要包含Module Magick。但我不确定。
I have also OS X and installed the RMagick with macports. Maybe you need also to include the Module Magick. But I'm not sure.
来自RMagick.rb的更多代码可能有助于检测问题..
Some more code from your RMagick.rb would maybe help to detect the problem..
这篇关于要求'RMagick'不工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!