无法在红宝石中使用redis

时间:2014-06-03 19:13:32

标签: ruby redis

虽然显然已经安装了,但我无法要求redis?我还能尝试什么?

$ sudo gem install redis
  Fetching: redis-3.0.7.gem (100%)
  Successfully installed redis-3.0.7
  Parsing documentation for redis-3.0.7
  Installing ri documentation for redis-3.0.7
  Done installing documentation for redis after 0 seconds
  1 gem installed
$ ./test.rb 
  /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such   file -- redis (LoadError)
    from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from ./test.rb:9:in `<main>'

我的代码:

#test.rb
#!/usr/bin/ruby
require 'redis'

1 个答案:

答案 0 :(得分:-1)

这可能是一个涉及在您的计算机上安装两个(或更多)Ruby的问题。

尝试比较运行gem environment时获得的RUBY VERSION行和ruby --version的结果