列出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.

当前回答

如果RVM安装了专用的ubuntu RVM安装程序https://github.com/rvm/ubuntu_rvm, RVM脚本的路径将不同于/usr/share/rvm/scripts/rvm.因此,要将它添加到你的.bashrc中,运行以下命令:

echo 'source "/usr/share/rvm/scripts/rvm"' >> ~/.bashrc

其他回答

对我来说,在Ubuntu(18.08)中,我在.bashrc中添加了下面的行,它可以工作。

 source /home/username/.rvm/scripts/rvm

请加上这一行。

     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.

如果RVM安装了专用的ubuntu RVM安装程序https://github.com/rvm/ubuntu_rvm, RVM脚本的路径将不同于/usr/share/rvm/scripts/rvm.因此,要将它添加到你的.bashrc中,运行以下命令:

echo 'source "/usr/share/rvm/scripts/rvm"' >> ~/.bashrc

您的控制台不是作为登录shell运行的,因此不能访问rvm功能。如果你正在运行Ubuntu,你可以:

打开控制台 选择“Edit -> Profile Preferences” 选择页签:标题和命令 复选框“作为登录shell运行命令” 重启终端

输入bash——从终端登录。然后给rvm使用2.0.0