我在我的英特尔 iMac 上运行默认的 Ruby 安装(ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin10])。我更新了 RubyGems 并安装了 wxruby gem。我正在尝试运行以下示例程序:
#!/usr/bin/ruby
require "rubygems"
require "wx"
class MyApp < Wx::App
def on_init
@frame = Wx::Frame.new(nil, -1, "The Bare Minimum")
@frame.show()
end
end
app = MyApp.new()
app.main_loop()
我收到以下错误:
==> wxruby-test.rb
/Library/Ruby/Gems/1.8/gems/wxruby-1.9.3-universal-darwin/lib/wxruby2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/wxruby-1.9.3-universal-darwin/lib/wxruby2.bundle, 9): no suitable image found. Did find: (LoadError)
/Library/Ruby/Gems/1.8/gems/wxruby-1.9.3-universal-darwin/lib/wxruby2.bundle: no matching architecture in universal wrapper - /Library/Ruby/Gems/1.8/gems/wxruby-1.9.3-universal-darwin/lib/wxruby2.bundle
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require'
from /Library/Ruby/Gems/1.8/gems/wxruby-1.9.3-universal-darwin/lib/wx.rb:12
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:60:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:60:in `require'
from wxruby-test.rb:3
如果我注释掉 require rubygems 语句,我会收到以下错误:
==> wxruby-test.rb
wxruby-test.rb:3:in `require': no such file to load -- wx (LoadError)
from wxruby-test.rb:3
我是 Mac 上的 Ruby 新手,我确信这是一些可能与路径有关的基本错误,但大多数关于环境变量的解释都是针对有经验的用户。如果您需要其他命令的更多输出,请告诉我。我正在从 tcsh shell 运行 Ruby。我确定我在做一些基本的错误,但我只是难住了。