1

我尝试使用 RubyInstaller 为 Windows 使用 Ruby 2.0 x64 和 Ruby 1.9.3。进入ruby -v按预期工作,并运行gem为我提供了预期的使用文档。运行和使用 Interactive Ruby 应用程序按预期工作。我正在运行 Windows 8.1 更新。

但是,对于这两种安装,运行ruby从 cmd 运行都会给我一个空白提示,我可以在其中键入,但是当我按 enter 时没有执行任何操作。如果我尝试安装 gem,程序运行时会出现类似的问题,但绝对没有输出,也没有任何反应。

我似乎无法在其他地方找到类似的问题。有谁知道可能出了什么问题,以及我该如何解决?

4

1 回答 1

1

What did you expect to happen? ruby.exe is the ruby interpreter, meant for running ruby scripts. Normally, to use it you would create a file containing valid ruby commands with your favorite text editor (but not a word processor). If you save the file as foobar.rb, typing ruby foobar.rb (or if you told the installer to associate .rb files with ruby, typing just foobar.rb) will execute the commands in the file as a script/program. If you don't supply a script file name, ruby goes into input mode and expects you to type in a program on the spot. It won't give any feedback until you indicate end-of-file by typing CTRL-z, at which point it will process what you typed and most likely tell you about all the errors you made. If you want line-by-line interactive feedback, use irb.

于 2014-09-06T05:36:33.410 回答