0

这是我运行并尝试使用 rbenv 安装 ruby​​ 1.9.3-p0 的命令列表,但每次运行时ruby --version我都会得到 1.8.23。我不确定这是为什么?

Anderss-MacBook-Pro:anchor anderskitson$ ruby --version
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
Anderss-MacBook-Pro:anchor anderskitson$ rbenv install 1.9.3-p0
Downloading yaml-0.1.4.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/36c852831d02cf90508c29852361d01b
Installing yaml-0.1.4...
Installed yaml-0.1.4 to /Users/anderskitson/.rbenv/versions/1.9.3-p0

Downloading ruby-1.9.3-p0.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/8e2fef56185cfbaf29d0c8329fc77c05
Installing ruby-1.9.3-p0...
Installed ruby-1.9.3-p0 to /Users/anderskitson/.rbenv/versions/1.9.3-p0

Downloading rubygems-1.8.23.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/178b0ebae78dbb46963c51ad29bb6bd9
Installing rubygems-1.8.23...
Installed rubygems-1.8.23 to /Users/anderskitson/.rbenv/versions/1.9.3-p0

Anderss-MacBook-Pro:anchor anderskitson$ ruby --version
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
Anderss-MacBook-Pro:anchor anderskitson$ rbenv global 1.9.3-p0
Anderss-MacBook-Pro:anchor anderskitson$ ruby --version
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
Anderss-MacBook-Pro:anchor anderskitson$ rbenv version
1.9.3-p0 (set by /Users/anderskitson/.rbenv/version)
Anderss-MacBook-Pro:anchor anderskitson$ 

更新

我为 rbenv global 发布了这个

Anderss-MacBook-Pro:anchor anderskitson$ $ rbenv global 1.9.3-p0
-bash: $: command not found
4

1 回答 1

4

rbenv global在使用rbenv 安装 ruby​​ 版本后,您需要设置希望 shell 使用的 ruby​​ 版本。

$ rbenv global 1.9.3-p0

有关更多信息,请参阅这些文档

于 2013-02-20T20:32:35.483 回答