使用RVM安装ruby 2.4.0,但在输入ruby之后,该命令只是无限期冻结。可以ctrl-C'ed出来,但红宝石永远不会加载。
Ruby信息:
ruby-2.4.0:
system:
uname: "Linux waffleboy 4.8.0-58-generic #63~16.04.1-Ubuntu SMP Mon Jun 26 18:08:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux"
name: "Ubuntu"
version: "16.04"
architecture: "x86_64"
bash: "/bin/bash => GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)"
zsh: "/usr/bin/zsh => zsh 5.1.1 (x86_64-ubuntu-linux-gnu)"
remote path: "ubuntu/16.04/x86_64"
rvm:
version: "rvm 1.29.2 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io/]"
updated: "23 minutes 20 seconds ago"
path: "/home/waffleboy/.rvm"
autolibs: "[4] Allow RVM to use package manager if found, install missing dependencies, install package manager (only OS X)."
ruby:
interpreter: "ruby"
version: "2.4.0p0"
date: "2016-12-24"
platform: "x86_64-linux"
patchlevel: "2016-12-24 revision 57164"
full_version: "ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]"
homes:
gem: "/home/waffleboy/.rvm/gems/ruby-2.4.0"
ruby: "/home/waffleboy/.rvm/rubies/ruby-2.4.0"
binaries:
ruby: "/home/waffleboy/.rvm/rubies/ruby-2.4.0/bin/ruby"
irb: "/home/waffleboy/.rvm/rubies/ruby-2.4.0/bin/irb"
gem: "/home/waffleboy/.rvm/rubies/ruby-2.4.0/bin/gem"
rake: "/home/waffleboy/.rvm/rubies/ruby-2.4.0/bin/rake"
environment:
PATH: "/home/waffleboy/.rvm/gems/ruby-2.4.0/bin:/home/waffleboy/.rvm/gems/ruby-2.4.0@global/bin:/home/waffleboy/.rvm/rubies/ruby-2.4.0/bin:/storage/anaconda3/bin:/home/waffleboy/bin:/home/waffleboy/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/usr/bin:/storage/programfiles/:/home/waffleboy/bin:/storage/programfiles/spark-1.6.2/bin:/home/waffleboy/.rvm/bin"
GEM_HOME: "/home/waffleboy/.rvm/gems/ruby-2.4.0"
GEM_PATH: "/home/waffleboy/.rvm/gems/ruby-2.4.0:/home/waffleboy/.rvm/gems/ruby-2.4.0@global"
MY_RUBY_HOME: "/home/waffleboy/.rvm/rubies/ruby-2.4.0"
IRBRC: "/home/waffleboy/.rvm/rubies/ruby-2.4.0/.irbrc"
RUBYOPT: ""
gemset: ""
Rvm列表:
rvm rubies
=* ruby-2.4.0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
我尝试过多次重新安装和安装ruby,但它似乎无法正常工作。
有人能指出我正确的方向吗? :)谢谢!
答案 0 :(得分:5)
这是正常的;这是一个功能,而不是一个错误。
在没有任何参数的情况下运行ruby
会导致程序运行并等待接收来自STDIN
的输入(以EOF
字符结尾)。在收到此信息之前,它不会执行任何操作。
如果您想以交互式模式运行ruby,(比如运行python
时),请使用ruby的内置irb
(&# 34;交互式ruby")命令。
或者,如果您只想显示有关安装的ruby版本的一些基本信息,那么您可以尝试以下命令:
ruby -v # Display version information
ruby -h # Display help about usage, switches and features
答案 1 :(得分:1)
如果您正在寻找一个REPL来输入Ruby代码,让它执行,并查看结果,那么您正在寻找irb
命令,而不是ruby
。
ruby
用于运行文件(例如。ruby my_file.rb
),或者不带参数将读取输入标准输入的脚本,当您使用cmd + D退出ruby
时将执行该脚本