使用RVM安装了Ruby 1.9.3,但命令行未显示ruby -v [英] Installed Ruby 1.9.3 with RVM but command line doesn't show 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
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屋!