Ruby需要错误

时间:2012-06-14 12:03:16

标签: ruby ubuntu gem require

要求安装的宝石不可见。

使用我安装好几次的hpricot进行测试:

irb(main):001:0> require "rubygems"
=> false
irb(main):002:0> require "hpricot"
LoadError: no such file to load -- hpricot
        from (irb):2:in `require'
        from (irb):2
        from /usr/bin/irb:12:in `<main>'
irb(main):003:0> 

RubyGems环境:

RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.7
  - RUBY VERSION: 1.9.2 (2010-07-02 patchlevel -1) [i486-linux]
  - INSTALLATION DIRECTORY: /var/lib/gems/1.9.2
  - RUBY EXECUTABLE: /usr/bin/ruby1.9.2
  - EXECUTABLE DIRECTORY: /var/lib/gems/1.9.2/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-linux
  - GEM PATHS:
     - /var/lib/gems/1.9.2
     - /root/.gem/ruby/1.9.2
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

我安装了多个版本的ruby(回溯5r2)

targeex@bt:/home/targeex/Stage/Application_Wissam# update-alternatives --config ruby
There are 2 choices for the alternative ruby (providing /usr/bin/ruby).

  Selection    Path                Priority   Status
------------------------------------------------------------
  0            /usr/bin/ruby1.8     600       auto mode
  1            /usr/bin/ruby1.8     600       manual mode
* 2            /usr/bin/ruby1.9.2   400       manual mode

Press enter to keep the current choice[*], or type selection number: 2

我该怎么办?

1 个答案:

答案 0 :(得分:2)

看起来你可能没有在正确的红宝石中安装宝石。如果可以,切换到使用RVM(https://rvm.io/),它将治愈你的痛苦。