[英]How to Downgrade from Ruby 1.9.2 to Ruby 1.8.7 to run Rails 2.0.2
I want to downgrade the Ruby version I have installed(Ruby 1.9.2) on Ubuntu 10.04 OS so that I can use the appropriate version of Ruby 1.8.7 to run Rails 2.0.2. 我想在Ubuntu 10.04操作系统上降级我安装的Ruby版本(Ruby 1.9.2),以便我可以使用适当版本的Ruby 1.8.7来运行Rails 2.0.2。 I am using the older version of Rails for project purpose.
我正在使用旧版本的Rails用于项目目的。
If I am using Rails 2.0.2 with Ruby 1.9.2 it gives me an error saying cant convert Enumerator into an array. 如果我在Ruby 1.9.2中使用Rails 2.0.2,它会给我一个错误,说无法将Enumerator转换为数组。
I thought I could use rvm, but I am not sure if its suitable for downgrade. 我以为我可以使用rvm,但我不确定它是否适合降级。
I get the following in the terminal when I use the command rvm list known 当我使用已知的命令rvm list时,我在终端中得到以下内容
mgj@pc146724-desktop:~$ rvm list known
# MRI Rubies
[ruby-]1.8.6[-p399]
[ruby-]1.8.6-head
[ruby-]1.8.7[-p302]
[ruby-]1.8.7-head
[ruby-]1.9.1-p243
[ruby-]1.9.1[-p376]
[ruby-]1.9.1-p429
[ruby-]1.9.1-head
[ruby-]1.9.2-preview1
[ruby-]1.9.2-preview3
[ruby-]1.9.2-rc1
[ruby-]1.9.2-rc2
[ruby-]1.9.2[-p0]
[ruby-]1.9.2-head
ruby-head
# JRuby
jruby-1.2.0
jruby-1.3.1
jruby-1.4.0
jruby-1.5.1
jruby-1.5.2
/home/mohnish/.rvm/config/known
I get the following in the list of installed ruby packages on using the command dpkg -l | 我使用命令dpkg -l |在安装的ruby包列表中获得以下内容 grep ruby
grep ruby
mgj@pc146724-desktop:~$ dpkg -l | grep ruby
ii libdbm-ruby 4.2 DBM interface for Ruby
ii libdbm-ruby1.8 1.8.7.249-2 DBM interface for Ruby 1.8
ii libgdbm-ruby 4.2 GDBM interface for Ruby
ii libgdbm-ruby1.8 1.8.7.249-2 GDBM interface for Ruby 1.8
ii libopenssl-ruby 4.2 OpenSSL interface for Ruby
ii libopenssl-ruby1.8 1.8.7.249-2 OpenSSL interface for Ruby 1.8
ii libreadline-ruby 4.2 Readline interface for Ruby
ii libreadline-ruby1.8 1.8.7.249-2 Readline interface for Ruby 1.8
ii libruby1.8 1.8.7.249-2 Libraries necessary to run Ruby 1.8
ii libtcltk-ruby 4.2 Tcl/Tk interface for Ruby
ii libtcltk-ruby1.8 1.8.7.249-2 Tcl/Tk interface for Ruby 1.8
ii rdoc 4.2 Generate documentation from ruby source file
ii ruby 4.2 An interpreter of object-oriented scripting
ii ruby-elisp 4.2 Emacs-lisp ruby-mode for Ruby
ii ruby-full 4.2 Ruby full installation
ii ruby1.8 1.8.7.249-2 Interpreter of object-oriented scripting lan
ii ruby1.8-dev 1.8.7.249-2 Header files for compiling extension modules
ii ruby1.8-elisp 1.8.7.249-2 ruby-mode for Emacsen
mgj@pc146724-desktop:~$ ^C
Do I need to uninstall Ruby 1.9.2 and only then freshly install Ruby 1.8.7 or can I switch versions?. 我是否需要卸载Ruby 1.9.2,然后才新安装Ruby 1.8.7或者我可以切换版本吗? If I can switch versions please direct me on how to set the path from Ruby 1.9.2 to Ruby 1.8.7.
如果我可以切换版本,请指导我如何设置从Ruby 1.9.2到Ruby 1.8.7的路径。 Or if there is some other way please let me know.
或者,如果有其他方式,请告诉我。
If I have to uninstall Ruby 1.9.2 and then freshly install Ruby 1.8.7 please let me know how can I go about it. 如果我必须卸载Ruby 1.9.2然后重新安装Ruby 1.8.7,请告诉我如何才能解决它。 I tried the following commands to uninstall Ruby 1.9.2 but it didn't seem to find the Ruby 1.9.2 package.
我尝试了以下命令来卸载Ruby 1.9.2但它似乎没有找到Ruby 1.9.2包。
sudo aptitude remove ruby
sudo aptitude remove ruby 1.9.2p0
sudo purge ruby
sudo aptitude purge ruby 1.9.2p0
When I checked for the current version of Ruby installed it shows: 当我检查当前版本的Ruby安装时,它显示:
mgj@pc146724-desktop:~/Downloads/rubygems_postextract/rubygems-1.4.1$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]
mgj@pc146724-desktop:~/Downloads/rubygems_postextract/rubygems-1.4.1$ which ruby
/home/mgj/.rvm/rubies/ruby-1.9.2-p0/bin/ruby
Thanks for your help..!! 谢谢你的帮助..!!
Whole point of RVM is so that you can have multiple versions of Ruby and switch among them easily.. RVM的全部意义在于您可以拥有多个版本的Ruby并轻松切换它们。
rvm install 1.8.7 #or some specific version - choose from the rvm list known
rvm use 1.8.7
rvm gemset create rails202 #create a gemset called "rails202" for Ruby 1.8.7
rvm 1.8.7@rails202 #make the gemset the current selection
gem install rails -v 2.0.2 #install rails (just for this gemset!)
#now, we have a gemset called "rails202" in Ruby 1.8.7.
#anytime we want to use it, we do:
rvm 1.8.7@rails202
#create as many gemsets needed, eg for rails 3.0.3 on Ruby 1.8.7 we can do the
#similar as above. Then to use the new gemset just do:
rvm 1.8.7@rails303
#et voila! we are now using Rails 3.0.3 on Ruby 1.8.7 !
Use RVM and save yourself weeks of pain. 使用RVM并节省数周的痛苦。
You can use multiple Ruby versions and each version has it's own separate set of gems. 您可以使用多个Ruby版本,每个版本都有自己独立的宝石。 That way you can have 1.8.7 and 1.9.2 installed simultaneously with Rails 2 and Rails 3 gems on the former and the latter respectively.
这样你就可以分别在前者和后者上安装与Rails 2和Rails 3宝石同时安装的1.8.7和1.9.2。
Installing a Ruby version is as simple as typing rvm install 1.9.2
or rvm install 1.8.7
. 安装Ruby版本就像输入
rvm install 1.9.2
或rvm install 1.8.7
一样简单。 To switch between the two: rvm 1.9.2
or rvm 1.8.7
. 要在两者之间切换:
rvm 1.9.2
或rvm 1.8.7
。
You can set the default Ruby with rvm --default 1.9.2
or rvm --default 1.8.7
. 您可以使用
rvm --default 1.9.2
或rvm --default 1.8.7
设置默认Ruby。
RVM won't touch your local Ruby nor it's gems. RVM不会触及您当地的Ruby,也不会触及宝石。 You can switch back to it at any time:
rvm system
. 你可以随时切换回它:
rvm system
。
source ~/.rvm/scripts/rvm source~ / .rvm / scripts / rvm
rvm reload ( Reload the latest rvm installed ) rvm reload(重新加载最新安装的rvm)
rvm install 1.8.7 rvm install 1.8.7
rvm use 1.8.7 --default rvm使用1.8.7 - 默认
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.