简体   繁体   English

无法使用RVM在红宝石版本之间切换

[英]Can't switch between ruby versions with rvm

I want to switch from ruby 1.9.3 to 2.0.0 . 我想从ruby 1.9.3切换到2.0.0

When I run rvm alias show default I get ruby-2.0.0-p481 当我运行rvm alias show default我得到ruby-2.0.0-p481

When I run rvm use default I get 当我运行rvm use default

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 an example.

Then when I run ruby -v I get ruby 1.9.3p484 然后当我运行ruby -v我得到ruby 1.9.3p484

I want to use 2.0.0 我想使用2.0.0

rvm 2.0.0 or rvm use 2.0.0 do not work either. rvm 2.0.0rvm use 2.0.0也不起作用。

Any ideas? 有任何想法吗? THanks! 谢谢!

Thanks to @japed I managed to solve the issue following the guide here . 感谢@japed,我按照这里的指南设法解决了这个问题。

I had to check the 'Run command as login shell' checkbox on the Title and Command tab of gnome-terminal's Edit ▸ Profile Preferences dialog. 我必须在gnome-terminal的“编辑▸概要文件首选项”对话框的“标题和命令”选项卡上选中“以登录壳运行命令”复选框。 Like here: 像这儿: 在此处输入图片说明

As you have already fixed the issue, so this is more of information than help, you can also do it by adding following line to you ~/.bashrc 由于您已经解决了该问题,因此这里提供的信息多于帮助,您还可以通过在~/.bashrc添加以下行来解决此问题。

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

This will permanently fix it. 这将永久修复它。

A temporary one time fix can also be: 临时的一次修复还可以是:

source ~/.rvm/scripts/rvm

PS: this is basically exactly what you have already done, but from command prompt PS:这基本上就是您已经完成的工作,但是从命令提示符

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

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