rvm中每个ruby版本的不同rubygem版本

时间:2021-07-18 07:00:29

I have ruby 1.8.7 and 1.9.3 installed by rvm. For each ruby version, I'd like to:

我有rvm安装的ruby 1.8.7和1.9.3。对于每个ruby版本,我想:

  • use gem 1.3.7 for ruby 1.8.7
  • 使用gem 1.3.7 for ruby​​ 1.8.7

  • use gem 1.8.x for ruby 1.9.3
  • 使用gem 1.8.x for ruby​​ 1.9.3

How can I set the above in rvm?

如何在rvm中设置以上内容?

3 个解决方案

#1


5  

When install rvm and then rvm install ruby --version its taken latest rubygems version. So just follow the below steps:

当安装rvm然后rvm安装ruby --version时采用最新的rubygems版本。所以请按照以下步骤操作:

  1. rvm use 1.8.7
  2. rvm使用1.8.7

  3. gem -v, e.g. shows 1.8.24 like that
    If you want to use rubygems particular version only follow steps #3 and #4.
    This is for syntax set the rubygems in rvm
  4. 宝石-v,例如显示1.8.24,如果你想使用rubygems特定版本只遵循步骤#3和#4。这是为了在rvm中设置rubygems的语法

  5. rvm rubygems [x.y.z|latest-x.y|latest|remove]
    Ex like this:
    Retrieving rubygems-1.3.7

    rvm ruby​​gems [x.y.z | latest-x.y | latest | remove]例如:检索rubygems-1.3.7

    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                             Dload  Upload   Total   Spent    Left  Speed
    100  284k  100  284k    0     0  94166      0  0:00:03  0:00:03 --:--:--  125k
    Extracting rubygems-1.3.7 ...
    Removing old Rubygems files...
    Installing rubygems-1.3.7 for ruby-1.8.7-p371 ...
    Installation of rubygems completed successfully.
    

    then

  6. gem -v => It shows 1.3.7

    gem -v =>显示1.3.7

  7. rvm rubygems 1.3.7
  8. rvm ruby​​gems 1.3.7

And If you want use any other version go to step #3

如果您想使用任何其他版本,请转到步骤#3

Ex: rvm rubygems latest

例如:最新的rvm ruby​​gems

#2


6  

$ rvm use 1.8.7
$ rvm rubygems 1.3.7
$ rvm use 1.9.3
$ rvm rubygems latest-1.8
$ gem -v
1.8.24
$ rvm use 1.8.7
$ gem -v
1.3.7

#3


0  

If you have already created gemsets in rvm for 1.3.7 and 1.8.x, skip this step. Otherwise, you need to create the gemset.

如果您已在rvm中为1.3.7和1.8.x创建了gemsets,请跳过此步骤。否则,您需要创建gemset。

Here is how to create a gemset and then switch to it: rvm 1.8.7 # switch to ruby 1.8.7 rvm gemset create 1.3.7 # you may have to do it this way: rvm --force rubygems 1.3.7 rvm gemset use 1.3.7 # use it

以下是如何创建一个gemset然后切换到它:rvm 1.8.7#切换到ruby 1.8.7 rvm gemset创建1.3.7#你可能必须这样做:rvm --force ruby​​gems 1.3.7 rvm gemset使用1.3.7#使用它

Next time you want to use ruby 1.8.7 with gemset 1.3.7 you only need to do this: rvm use 1.8.7@1.3.7 # this sets the ruby version and gem version ruby -v # checks the ruby version, should = 1.8.7 gem --version # checks the gemset version, should = 1.3.7

下次你想使用带有gemset 1.3.7的ruby 1.8.7你只需要这样做:rvm使用1.8.7@1.3.7#这设置了ruby版本和gem版本ruby -v#检查ruby版本,应该= 1.8.7 gem --version#检查gemset版本,应该= 1.3.7

Repeat this for ruby 1.9.3 and gemset 1.8.x.

对ruby 1.9.3和gemset 1.8.x重复此操作。

You can find out how to do this and find answers to questions other rvm related topics here: http://rvm.io/gemsets/using

您可以在此处找到如何执行此操作并查找其他rvm相关主题的问题的答案:http://rvm.io/gemsets/using

#1


5  

When install rvm and then rvm install ruby --version its taken latest rubygems version. So just follow the below steps:

当安装rvm然后rvm安装ruby --version时采用最新的rubygems版本。所以请按照以下步骤操作:

  1. rvm use 1.8.7
  2. rvm使用1.8.7

  3. gem -v, e.g. shows 1.8.24 like that
    If you want to use rubygems particular version only follow steps #3 and #4.
    This is for syntax set the rubygems in rvm
  4. 宝石-v,例如显示1.8.24,如果你想使用rubygems特定版本只遵循步骤#3和#4。这是为了在rvm中设置rubygems的语法

  5. rvm rubygems [x.y.z|latest-x.y|latest|remove]
    Ex like this:
    Retrieving rubygems-1.3.7

    rvm ruby​​gems [x.y.z | latest-x.y | latest | remove]例如:检索rubygems-1.3.7

    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                             Dload  Upload   Total   Spent    Left  Speed
    100  284k  100  284k    0     0  94166      0  0:00:03  0:00:03 --:--:--  125k
    Extracting rubygems-1.3.7 ...
    Removing old Rubygems files...
    Installing rubygems-1.3.7 for ruby-1.8.7-p371 ...
    Installation of rubygems completed successfully.
    

    then

  6. gem -v => It shows 1.3.7

    gem -v =>显示1.3.7

  7. rvm rubygems 1.3.7
  8. rvm ruby​​gems 1.3.7

And If you want use any other version go to step #3

如果您想使用任何其他版本,请转到步骤#3

Ex: rvm rubygems latest

例如:最新的rvm ruby​​gems

#2


6  

$ rvm use 1.8.7
$ rvm rubygems 1.3.7
$ rvm use 1.9.3
$ rvm rubygems latest-1.8
$ gem -v
1.8.24
$ rvm use 1.8.7
$ gem -v
1.3.7

#3


0  

If you have already created gemsets in rvm for 1.3.7 and 1.8.x, skip this step. Otherwise, you need to create the gemset.

如果您已在rvm中为1.3.7和1.8.x创建了gemsets,请跳过此步骤。否则,您需要创建gemset。

Here is how to create a gemset and then switch to it: rvm 1.8.7 # switch to ruby 1.8.7 rvm gemset create 1.3.7 # you may have to do it this way: rvm --force rubygems 1.3.7 rvm gemset use 1.3.7 # use it

以下是如何创建一个gemset然后切换到它:rvm 1.8.7#切换到ruby 1.8.7 rvm gemset创建1.3.7#你可能必须这样做:rvm --force ruby​​gems 1.3.7 rvm gemset使用1.3.7#使用它

Next time you want to use ruby 1.8.7 with gemset 1.3.7 you only need to do this: rvm use 1.8.7@1.3.7 # this sets the ruby version and gem version ruby -v # checks the ruby version, should = 1.8.7 gem --version # checks the gemset version, should = 1.3.7

下次你想使用带有gemset 1.3.7的ruby 1.8.7你只需要这样做:rvm使用1.8.7@1.3.7#这设置了ruby版本和gem版本ruby -v#检查ruby版本,应该= 1.8.7 gem --version#检查gemset版本,应该= 1.3.7

Repeat this for ruby 1.9.3 and gemset 1.8.x.

对ruby 1.9.3和gemset 1.8.x重复此操作。

You can find out how to do this and find answers to questions other rvm related topics here: http://rvm.io/gemsets/using

您可以在此处找到如何执行此操作并查找其他rvm相关主题的问题的答案:http://rvm.io/gemsets/using