使用 RVM,但无法设置当前的 Ruby 版本 (Ubuntu 11.10) [英] Using RVM, but can't set current Ruby version (Ubuntu 11.10)

查看:46
本文介绍了使用 RVM,但无法设置当前的 Ruby 版本 (Ubuntu 11.10)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在全新安装的 Ubuntu 11.10 上安装了 RVM,但不知道如何开始使用特定的 ruby​​ 版本.

I have recently installed RVM on a fresh install of Ubuntu 11.10 and can not work out how to start using a particular ruby version.

我已经安装了 Ruby 1.8.7 和 1.9.2,它们都很好地显示在列表中:

I have installed Ruby 1.8.7 and 1.9.2, and they show up in the list fine:

$ rvm list
rvm rubies
   ruby-1.8.7-p352 [ i386 ]
   ruby-1.9.2-p290 [ i386 ]

当我尝试使用use"命令时,一切似乎都很好:

When I try to use the "use" command, everything seems fine:

$ rvm use 1.9.2
Using /usr/share/ruby-rvm/gems/ruby-1.9.2-p290
Running /usr/share/ruby-rvm/hooks/after_use

但是当我测试当前的 ruby​​ 版本时,我得到了当您根本没有 RVM 时通常会得到的 Ubuntu 11.10 消息:

But then when I test the current ruby version, I get the usual Ubuntu 11.10 message you get when you don't have RVM at all:

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

我做错了什么?我是否错过了 RVM 安装中的某个步骤?

What am I doing wrong? Did I miss out a step in the RVM installation or something?

编辑*

对一些评论的回答:

$ which ruby
#returns nothing at all.

$ which rvm 
/usr/bin/rvm

$ rvm -v
rvm 1.6.9 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]

$ echo $PATH
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

推荐答案

RVM 1.6.9 现在已经很老了.你是通过一些包管理器安装的吗?如果是这样,摆脱它并在你的 bash shell 中运行以下命令:

RVM 1.6.9 is very old now. Did you install it through some package manager? If so, get rid of it and run the following in your bash shell:

curl -L https://get.rvm.io |bash -s 稳定

然后,放置 [[ -s "$HOME/.rvm/scripts/rvm" ]] &&.~/.profile 中的$HOME/.rvm/scripts/rvm" OR ~/.bash_profile OR ~/.bashrc>

Then, place [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" in ~/.profile OR ~/.bash_profile OR ~/.bashrc

然后您应该能够运行 type rvm |head -n 1 并且它应该说rvm 是一个函数".

You should then be able to run type rvm | head -n 1 and it should say "rvm is a function".

然后您应该能够安装红宝石并使用其中之一.请务必使用 --default 使该 Ruby 保持默认值,即使在您结束终端会话后也是如此.例如.rvm 使用 ruby​​-1.9.2-p290 --default

Then you should be able to install rubies and use one of them. Be sure to use --default for that Ruby to remain the default even after you end your terminal session. E.g. rvm use ruby-1.9.2-p290 --default

这篇关于使用 RVM,但无法设置当前的 Ruby 版本 (Ubuntu 11.10)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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