使用 RVM 安装了 Ruby 1.9.3,但命令行不显示 ruby​​ -v [英] Installed Ruby 1.9.3 with RVM but command line doesn't show ruby -v

查看:37
本文介绍了使用 RVM 安装了 Ruby 1.9.3,但命令行不显示 ruby​​ -v的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是控制台输出:

sergio@sergio-VirtualBox:~$ rvm list

rvm rubies

   ruby-1.9.3 [ i386 ]

sergio@sergio-VirtualBox:~$ rvm use 1.9.3
Using /usr/share/ruby-rvm/gems/ruby-1.9.3

sergio@sergio-VirtualBox:~$ ruby -v
The program 'ruby' can be found in the following packages:
 * ruby1.8
 * ruby1.9.1
Try: sudo apt-get install <selected package>

那是怎么回事?我需要重新启动我的机器吗?或者它应该立即起作用?我正在使用 Ubuntu 11.10,感谢您的帮助.

So what's going on? Do I need to reboot my machine? Or should it work right off the bat? I'm using Ubuntu 11.10, any help is appreciated.

推荐答案

您的 RVM 版本已损坏.Ubuntu 对 RVM 做了一些会产生大量错误的事情,目前唯一安全的修复方法是:

You have broken version of RVM. Ubuntu does something to RVM that produces lots of errors, the only safe way of fixing for now is to:

sudo apt-get --purge remove ruby-rvm
sudo rm -rf /usr/share/ruby-rvm /etc/rvmrc /etc/profile.d/rvm.sh

打开新终端并验证旧 RVM 设置中的环境是否干净(应该没有输出):

open new terminal and validate environment is clean from old RVM settings (should be no output):

env | grep rvm

如果有输出,请尝试打开新终端,如果没有帮助,则重新启动计算机.

if there was output, try to open new terminal, if it does not help then restart your computer.

安装 RVM:

curl -L https://get.rvm.io | 
  bash -s stable --ruby --autolibs=enable --auto-dotfiles

如果您发现需要一些帮助,请查看 在 Ubuntu 12.04 上安装 Ruby,这里提供了更多解释.

If you find you need some hand-holding, take a look at Installing Ruby on Ubuntu 12.04, which gives a bit more explanation.

这篇关于使用 RVM 安装了 Ruby 1.9.3,但命令行不显示 ruby​​ -v的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆