列出ruby版本

console:~$ rvm list

rvm rubies

ruby-2.0.0-p481 [ i686 ]

# => - current
# =* - current && default
#  * - default

尝试使用特定版本的ruby

console:~$ rvm use 2.0.0

RVM is not a function, selecting rubies with 'rvm use ...' will not work.

You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for a example.

当前回答

和其他答案一样的原则,只是觉得这比重新开放终端更快:)

bash -l -c "rvm use 2.0.0"

其他回答

如果你不想每次打开一个终端都这样,再做一遍上面的建议,只需添加

source ~/.rvm/scripts/rvm

在~/.bashrc的末尾

和其他答案一样的原则,只是觉得这比重新开放终端更快:)

bash -l -c "rvm use 2.0.0"

您需要添加源~/。Rvm /scripts/ Rvm到~/。your_shellrc文件。从现在开始,当你加载一个shell时,rvm将被加载。

例如:

如果你使用的是ZSH shell,需要添加~/。zshrc中

如果您使用bash shell,需要添加~/。bashrc文件(

然后打开一个新标签,看看效果。

     Usually this is caused by shell initialization files. Search for PATH=... entries.
     You can also re-add RVM to your profile by running: rvm get stable --auto-dotfiles
     To fix it temporarily in this shell session run: rvm use ruby-2.6.5
     To ignore this error add "rvm_silence_path_mismatch_check_flag=1" to your "~/.rvmrc" file.

以下工作为我在ubuntu 19.1

source ~/.rvm/scripts/rvm