[英]Switching between Compiled and rvm versions of Ruby
I'm currently trying to learn Rails, and in the process, I compiled Ruby on my own, as I did with Python, expecting the same process. 我目前正在尝试学习Rails,并且在此过程中,就像在Python中一样,我自己编译了Ruby,期望实现相同的过程。
However, after digging a bit, I eventually gave up and just started using rvm. 但是,经过一番挖掘,我最终放弃了,只是开始使用rvm。 I've installed everything, but after a few moments realized my system (Ubuntu 11.10) thought I was using the version of Ruby I compiled (which was missing
openssl
) rather than rvm's version of Ruby, which was complete. 我已经安装了所有内容,但片刻之后意识到我的系统(Ubuntu 11.10)以为我使用的是我编译的Ruby版本(缺少
openssl
),而不是rvm的Ruby版本。
I "uninstalled" it according to this post , and after reinstalling rvm's Ruby with openssl
, iconv
, and rails, I'm now getting the following error message: 我根据这篇文章 “卸载”了它,并用
openssl
, iconv
和rails重新安装了rvm的Ruby之后,现在出现以下错误消息:
secretasianman@ubuntu:~/Projects/first_app$ rails server
bash: /usr/local/bin/rails: /usr/local/bin/ruby: bad interpreter: No such file or directory
Any idea on how to fix this? 关于如何解决此问题的任何想法? I've edited the last two lines of
~/.bashrc
to read like the following, but to no avail. 我已编辑
~/.bashrc
的最后两行,内容如下所示,但无济于事。
PATH=$PATH:$HOME/.rvm/bin:$HOME/.rvm/rubies/ruby-1.9.3-p125/bin # Add RVM to PATH for scripting
export PATH
try adding to ~/.bashrc 尝试添加到〜/ .bashrc
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
then in a new shell try 然后在新的外壳中尝试
ruby -v
You may want to give a look to rbenv which works in a simpler way (just changing PATH) 您可能想看看rbenv ,它的工作方式更简单(只需更改PATH)
To install it (I use .bashrc instead of .bash_profile). 要安装它(我使用.bashrc而不是.bash_profile)。 Make sure you remove all traces of rvm:
确保删除所有rvm痕迹:
$ cd
$ git clone git://github.com/sstephenson/rbenv.git .rbenv
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
And restart your shell: 并重新启动您的shell:
$ exec $SHELL
To get the "rbenv install" command to install a particular version, install also ruby-build . 要获取“ rbenv install”命令来安装特定版本,请同时安装ruby-build 。 rbenv separates the two commands so that rbenv also works with custom built rubies.
rbenv分隔了这两个命令,因此rbenv也可以与定制的红宝石一起使用。
$ git clone git://github.com/sstephenson/ruby-build.git
$ cd ruby-build
$ ./install.sh
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.