简体   繁体   English

无法在RVM中更改默认的Ruby版本

[英]Can't change default Ruby version in RVM

When I do ruby -v I get: 当我做ruby -v我得到:

ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

which ruby returns: which ruby返回:

/usr/bin/ruby

rvm list returns: rvm list返回:

rvm rubies
=* ruby-2.1.0 [ x86_64 ]
ruby-2.1.2 [ x86_64 ]
# => - current
# =* - current && default
#  * - default

When I change the current and default Ruby version to 2.1.0. 当我将当前和默认的Ruby版本更改为2.1.0时。 then ruby -v returns: 然后ruby -v返回:

ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]

And which ruby shows: 以及which ruby显示:

/home/akhil/.rvm/rubies/ruby-2.1.0/bin/ruby

But in a new terminal ruby -v again shows: 但是在新的终端ruby -v再次显示:

ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

I don't want to change the default Ruby version every time. 我不想每次都更改默认的Ruby版本。

cat ~/.bash_profile returns 猫〜/ .bash_profile返回

[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

I'm not sure what command you're using to change the ruby version in rvm, you didn't specify. 我不确定您未使用什么命令来更改rv​​m中的ruby版本。 My hunch is you're using rvm use , this is only temporary for the shell session. 我的预感是您正在使用rvm use ,这对于shell会话来说只是暂时的。 To change it permanently use rvm default : 要永久更改它,请使用rvm default

rvm --default use ruby-2.1.0

This change will persist to new shell sessions. 此更改将保留到新的Shell会话。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM