rvm使用1.9.2让我使用ruby 1.8.7

时间:2012-01-08 08:25:46

标签: ruby rvm

我不明白为什么在rvm命令之后我仍然使用ruby 1.8.7。我按照rvm的安装说明进行操作,一切似乎都没问题 - 我在哪里开始解决这个问题?

andrew@unifex:~$ rvm use 1.9.2 --default
Using /home/andrew/.rvm/gems/ruby-1.9.2-p290
andrew@unifex:~$ ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
andrew@unifex:~$

andrew@unifex:~$ rvm info

ruby-1.9.2-p290:

  system:
    uname:       "Linux unifex 2.6.22-3-amd64 #1 SMP Sun Nov 4 18:18:09 UTC 2007 x86_64 GNU/Linux"
    bash:        "/bin/bash => GNU bash, version 3.1.17(1)-release (x86_64-pc-linux-gnu)"
    zsh:         " => not installed"

  rvm:
    version:      "rvm 1.9.2 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]"

  ruby:
    interpreter:  "ruby"
    version:      "1.9.2p290"
    date:         "2011-07-09"
    platform:     "x86_64-linux"
    patchlevel:   "2011-07-09 revision 32553"
    full_version: "ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]"

  homes:
    gem:          "/home/andrew/.rvm/gems/ruby-1.9.2-p290"
    ruby:         "/home/andrew/.rvm/rubies/ruby-1.9.2-p290"

  binaries:
    ruby:         "/home/andrew/.rvm/rubies/ruby-1.9.2-p290/bin/ruby"
    irb:          "/home/andrew/.rvm/rubies/ruby-1.9.2-p290/bin/irb"
    gem:          "/home/andrew/.rvm/rubies/ruby-1.9.2-p290/bin/gem"
    rake:         "/home/andrew/.rvm/gems/ruby-1.9.2-p290/bin/rake"

  environment:
    PATH:         "/home/andrew/.rvm/gems/ruby-1.9.2-p290/bin:/home/andrew/.rvm/gems/ruby-1.9.2-p290@global/bin:/home/andrew/.rvm/rubies/ruby-1.9.2-p290/bin:/home/andrew/.rvm/bin:/usr/local/java/jdk1.6.0_20/bin:/usr/local/apache/maven/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/local/java/jdk1.6.0_03/bin"
    GEM_HOME:     "/home/andrew/.rvm/gems/ruby-1.9.2-p290"
    GEM_PATH:     "/home/andrew/.rvm/gems/ruby-1.9.2-p290:/home/andrew/.rvm/gems/ruby-1.9.2-p290@global"
    MY_RUBY_HOME: "/home/andrew/.rvm/rubies/ruby-1.9.2-p290"
    IRBRC:        "/home/andrew/.rvm/rubies/ruby-1.9.2-p290/.irbrc"
    RUBYOPT:      ""
    gemset:       ""

1 个答案:

答案 0 :(得分:4)

我遇到了这个问题。这取决于你的$ PATH不正确 - 在rvm有机会做它之前找到/ usr / bin / ruby​​。

在你的〜/ .bash_profile中(如在/Users/andrew/.bash_profile中),确保你在文件的底部显示这一行:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

然后打开一个新的shell

rvm reload
rvm use 1.9.2 --default
ruby -v

您现在应该显示正确的版本。