错误代码如下:
c:>ocra test-tk.rb
=== Loading script to check dependencies
D:/Ruby193-2/lib/ruby/1.9.1/tk/console.rb:13:in _create_console': interpreter is deleted (RuntimeError)
from D:/Ruby193-2/lib/ruby/1.9.1/tk/console.rb:13:in
create'
from D:/Ruby193-2/lib/ruby/1.9.1/tk/console.rb:15:in <module:TkConsole>
'
from D:/Ruby193-2/lib/ruby/1.9.1/tk/console.rb:6:in
'
from D:/Ruby193-2/lib/ruby/gems/1.9.1/gems/ocra-1.3.3/bin/ocra:474:in const_get'
from D:/Ruby193-2/lib/ruby/gems/1.9.1/gems/ocra-1.3.3/bin/ocra:474:in
block (3 levels) in attempt_load_autoload'
from D:/Ruby193-2/lib/ruby/gems/1.9.1/gems/ocra-1.3.3/bin/ocra:468:in each'
from D:/Ruby193-2/lib/ruby/gems/1.9.1/gems/ocra-1.3.3/bin/ocra:468:in
block (2 levels) in attempt_load_autoload'
from D:/Ruby193-2/lib/ruby/gems/1.9.1/gems/ocra-1.3.3/bin/ocra:466:in each'
from D:/Ruby193-2/lib/ruby/gems/1.9.1/gems/ocra-1.3.3/bin/ocra:466:in
block in attempt_load_autoload'
from D:/Ruby193-2/lib/ruby/gems/1.9.1/gems/ocra-1.3.3/bin/ocra:460:in loop'
from D:/Ruby193-2/lib/ruby/gems/1.9.1/gems/ocra-1.3.3/bin/ocra:460:in
attempt_load_autoload'
from D:/Ruby193-2/lib/ruby/gems/1.9.1/gems/ocra-1.3.3/bin/ocra:706:in build_exe'
from D:/Ruby193-2/lib/ruby/gems/1.9.1/gems/ocra-1.3.3/bin/ocra:1165:in
block in '
test-tk.rb 的代码如下:
require 'tk'
root = TkRoot.new { title "Hello, World!" }
TkLabel.new(root) do
text 'Hello, World!'
pack { padx 15 ; pady 15; side 'left' }
end
Tk.mainloop
我家的系统是 win7-64,所用的是 rubyinstaller-1.9.3-p550 以及它自带的 TK 库,但是我试过 Ruby 2.1.5-p273 也是报错。有哪位高手知道怎么解决的吗?