我查看了RVM站点http://rvm.io/integration/tk和几个StackOverflow问题,例如RVM Ruby with TK installation (OSX).
我试过rvm重新安装2.0.0 –enable-shared –enable-pthread –with-tk –with-tcl在不同版本的ruby上多次没有成功.
有什么想法吗?
当我运行irb并且确实需要’我得到以下内容:
LoadError: cannot load such file -- tk from /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' from /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' from (irb):2 from /home/brooks/.rvm/rubies/ruby-2.0.0-p353/bin/irb:12:in `<main>'
当这工作时,我认为你应该得到真实的回报.
我还没有尝试过其他任何事情,主要是因为我无法弄清楚还有什么可做的.我一直在研究如何工作并检查加载路径与ruby -e’$:’我得到
[brooks@ubuntu:~/sites/depot]$ruby -e 'puts $:' /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0 /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/x86_64-linux /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/vendor_ruby/2.0.0 /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/vendor_ruby/2.0.0/x86_64-linux /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/vendor_ruby /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0 /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/x86_64-linux
我认为这看起来像你期望的那样.对不起格式化,我是编辑的新手.
继续认为这是一个路径问题,我在我的文件中找到了tk.rb并在irb中尝试了以下内容:
2.0.0-p353 :003 > require '/home/brooks/.rvm/src/ruby-2.0.0-p353/ext/tk/lib/tk' LoadError: cannot load such file -- tcltklib from /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' from /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' from /home/brooks/.rvm/src/ruby-2.0.0-p353/ext/tk/lib/tk.rb:6:in `<top (required)>' from /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' from /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' from (irb):3 from /home/brooks/.rvm/rubies/ruby-2.0.0-p353/bin/irb:12:in `<main>'
所以现在它需要tk.rb文件中的’tcltklib’导致问题.这似乎证实了$PATH或$load_path存在一些问题.但搜索文件tcltklib.rb没有任何结果.有一个tcltklib.c文件.
我尝试了一些其他的东西.在通过rvm更仔细地读取ruby安装的输出之后,有一个关于X11 lib未安装的警告,并且在ruby构建之后Tk不会处于活动状态.我做了sudo apt-get install libx11-dev然后rvm再次重新安装2.0.0 –enable-shared –enable-pthread –with-tk –with-tcl.这次在irb中需要’tk’引起核心转储.我又试了一次,但它确实奏效了.然后我运行了一个短的ruby脚本,它也使用require’tk’.它也是核心倾销,但经过几次尝试后工作.现在它的成功与否,有时是有效的,有时是核心转储.