gpt4 book ai didi

ruby - RVM:可以设置默认ruby版本但不能设置当前版本

转载 作者:行者123 更新时间:2023-12-05 04:12:44 25 4
gpt4 key购买 nike

问题:尽管默认的 ruby​​ 设置为 ruby​​ 2.2.2。当我打开终端时,ruby 2.2.1 被加载。我如何确保在打开新终端时加载 ruby​​ 2.2.2。

问题表述不同:除非卸载 ruby​​ 2.2.1,否则我无法将 current && default 设置为 ruby​​ 2.2.2。这是我输入 rvm list

时得到的结果
   ~ $ rvm list

rvm rubies

ruby-1.8.7-head [ x86_64 ]
ruby-1.8.7-p374 [ x86_64 ]
ruby-1.9.3-p551 [ x86_64 ]
ruby-2.0.0-p353 [ x86_64 ]
ruby-2.2.0 [ x86_64 ]
=> ruby-2.2.1 [ x86_64 ]
* ruby-2.2.2 [ x86_64 ]
ruby-2.2.4 [ x86_64 ]

# => - current
# =* - current && default
# * - default

我希望 current && default 是 ruby​​-2.2.2。如果我输入 rvm use default,我会得到如下结果(这正是我想要的)。

~ $ rvm list

rvm rubies

ruby-1.8.7-head [ x86_64 ]
ruby-1.8.7-p374 [ x86_64 ]
ruby-1.9.3-p551 [ x86_64 ]
ruby-2.0.0-p353 [ x86_64 ]
ruby-2.2.0 [ x86_64 ]
ruby-2.2.1 [ x86_64 ]
=* ruby-2.2.2 [ x86_64 ]
ruby-2.2.4 [ x86_64 ]

# => - current
# =* - current && default
# * - default

如何确保无论何时打开终端,环境 current && default 都设置为 ruby​​ 2.2.2,如上所示?观察:如果我卸载 ruby​​ 2.2.1 它默认为上述情况。我有一些项目需要 ruby​​ 2.2.1,但我不能那样做。

我该怎么办?

顺便说一句,which ruby​​ 给出了以下输出:

~ $ which ruby
/home/rk/.rvm/rubies/ruby-2.2.1/bin/ruby

这是一个类似的问题,但没有得到回答: RVM default is 2.1.1 but 2.1.2 is loaded initially

这是 rvm info 的输出:

~ $ rvm info

ruby-2.2.1:

system:
uname: "Linux X200 4.4.0-36-generic #55~14.04.1-Ubuntu SMP Fri Aug 12 11:49:30 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux"
system: "ubuntu/14.04/x86_64"
bash: "/bin/bash => GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)"
zsh: " => not installed"

rvm:
version: "rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "1 year 3 months 21 days 22 hours 56 minutes 31 seconds ago"
path: "/home/rk/.rvm"

ruby:
interpreter: "ruby"
version: "2.2.1p85"
date: "2015-02-26"
platform: "x86_64-linux"
patchlevel: "2015-02-26 revision 49769"
full_version: "ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]"

homes:
gem: "/home/rk/.rvm/gems/ruby-2.2.1"
ruby: "/home/rk/.rvm/rubies/ruby-2.2.1"

binaries:
ruby: "/home/rk/.rvm/rubies/ruby-2.2.1/bin/ruby"
irb: "/home/rk/.rvm/rubies/ruby-2.2.1/bin/irb"
gem: "/home/rk/.rvm/rubies/ruby-2.2.1/bin/gem"
rake: "/home/rk/.rvm/rubies/ruby-2.2.1/bin/rake"

environment:
PATH: "/home/rk/.rvm/gems/ruby-2.2.1/bin:/home/rk/.rvm/gems/ruby-2.2.1@global/bin:/home/rk/.rvm/rubies/ruby-2.2.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/rk/.rvm/bin:/home/rk/.rvm/bin:/usr/local/heroku/bin:/home/rk/android-studio/bin:/home/rk/.rvm/bin"
GEM_HOME: "/home/rk/.rvm/gems/ruby-2.2.1"
GEM_PATH: "/home/rk/.rvm/gems/ruby-2.2.1:/home/rk/.rvm/gems/ruby-2.2.1@global"
MY_RUBY_HOME: "/home/rk/.rvm/rubies/ruby-2.2.1"
IRBRC: "/home/rk/.rvm/rubies/ruby-2.2.1/.irbrc"
RUBYOPT: ""
gemset: ""

最佳答案

我按照命令完成工作

rvm --default use 2.2.2

您可能遇到登录 shell 问题,需要使用 /bin/bash --login 作为命令

关于ruby - RVM:可以设置默认ruby版本但不能设置当前版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39826179/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com