我刚做了apt-get install ruby.1.9.1
,安装成功。现在当我这样做时ruby -v
,它仍然是 1.8.7。为什么不使用新安装的版本?我不知道为什么,但我无法通过谷歌找到任何关于如何在没有 rvm 的情况下管理 ruby 版本的信息。我知道 rvm 很棒,但在这种情况下,它必须没有 rvm。
有谁能够帮助我?
我刚做了apt-get install ruby.1.9.1
,安装成功。现在当我这样做时ruby -v
,它仍然是 1.8.7。为什么不使用新安装的版本?我不知道为什么,但我无法通过谷歌找到任何关于如何在没有 rvm 的情况下管理 ruby 版本的信息。我知道 rvm 很棒,但在这种情况下,它必须没有 rvm。
有谁能够帮助我?
这只是如何解决此问题的示例。您的系统上的路径和文件名可能不同,但您应该从这里了解:
# First locate the original ruby
> which ruby
/usr/bin/ruby # <- Your path might be different
# Then locate ruby19
> which ruby19
/usr/bin/ruby19
# Move the old ruby out of the way
> mv /usr/bin/ruby /usr/bin/ruby_old
# Link ruby to the new ruby (ruby19)
# ln -s is used to create a new symbolic link. See "man ln" for more info.
> cd /usr/bin
> ln -s ruby19 ruby
现在你应该有:
/usr/bin/ruby_old # The old executable
/usr/bin/ruby -> /usr/bin/ruby19 # The new link
/usr/bin/ruby19 # The new executable
Note: it's easy to break your system ruby if you're not careful using this method. That's why RVM is usually a better solution if you have the choice. You can leave a comment if something breaks, and I will try and improve the instructions.
最好通过 RVM 安装 Ruby,并通过 RVM 切换到某个版本,
rvm use ruby-1.9.2 --default