我使用Debian Linux在Raspberry Pi上安装了rvm和Ruby 1.9.3p194。当我使用gem install pry安装pry时,一切都安装完美,但是在终端中键入pry无法正常工作:

pi@raspberrypi ~ $ pry
bash: pry: command not found
~/.rvm/gems/ruby-1.9.3-p194/bin中有一个 pry 文件。我必须在同一目录中用ruby_noexec_wrapper调用它:
pi@raspberrypi ~ $ .rvm/gems/ruby-1.9.3-p194/bin/pry
/usr/bin/env: ruby_noexec_wrapper: No such file or directory
pi@raspberrypi ~ $ cd .rvm/gems/ruby-1.9.3-p194/bin
pi@raspberrypi ~/.rvm/gems/ruby-1.9.3-p194/bin $ ./ruby_noexec_wrapper pry
[1] pry(main)>

在此Linux中运行 pry 动的正确方法是什么?在Windows和Mac OS X上,我可以在任何命令提示符或终端上简单地键入pry。

更新:这是我的rvm info:
pi@raspberrypi ~/.rvm/gems/ruby-1.9.3-p194/bin $ rvm info

ruby-1.9.3-p194:

  system:
    uname:       "Linux raspberrypi 3.1.9+ #168 PREEMPT Sat Jul 14 18:56:31 BST 2012 armv6l GNU/Linux"
    bash:        "/bin/bash => GNU bash, version 4.2.20(1)-release (arm-unknown-linux-gnueabihf)"
    zsh:         " => not installed"

  rvm:
    version:      "rvm 1.14.10 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]"
    updated:      "1 day 23 hours 36 minutes 30 seconds ago"

  ruby:
    interpreter:  "ruby"
    version:      "1.9.3p194"
    date:         "2012-04-20"
    platform:     "armv6l-linux-eabi"
    patchlevel:   "2012-04-20 revision 35410"
    full_version: "ruby 1.9.3p194 (2012-04-20 revision 35410) [armv6l-linux-eabi]"

  homes:
    gem:          "/home/pi/.rvm/gems/ruby-1.9.3-p194"
    ruby:         "/home/pi/.rvm/rubies/ruby-1.9.3-p194"

  binaries:
    ruby:         "/home/pi/.rvm/rubies/ruby-1.9.3-p194/bin/ruby"
    irb:          "/home/pi/.rvm/rubies/ruby-1.9.3-p194/bin/irb"
    gem:          "/home/pi/.rvm/rubies/ruby-1.9.3-p194/bin/gem"
    rake:         "/home/pi/.rvm/gems/ruby-1.9.3-p194@global/bin/rake"

  environment:
    PATH:         "/home/pi/.rvm/gems/ruby-1.9.3-p194/bin:/home/pi/.rvm/gems/ruby-1.9.3-p194@global/bin:/home/pi/.rvm/rubies/ruby-1.9.3-p194/bin:/home/pi/.rvm/bin:/usr/lib/arm-linux-gnueabihf/libfm:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
    GEM_HOME:     "/home/pi/.rvm/gems/ruby-1.9.3-p194"
    GEM_PATH:     "/home/pi/.rvm/gems/ruby-1.9.3-p194:/home/pi/.rvm/gems/ruby-1.9.3-p194@global"
    MY_RUBY_HOME: "/home/pi/.rvm/rubies/ruby-1.9.3-p194"
    IRBRC:        "/home/pi/.rvm/rubies/ruby-1.9.3-p194/.irbrc"
    RUBYOPT:      ""
    gemset:       ""

最佳答案

首先确保rvm已正确加载:

type rvm | head -n 1 # should be: rvm is a function
type gem | head -n 1 # should be: gem is a function

如果它们不是函数,这意味着RVM没有正确加载,这可能是您的Shell中的错误(例如受限的bash),您可以尝试使用以下方法修复它:
rvm get head --auto

在运行此命令后,可能需要重新登录以运行所有 shell 程序配置文件。

接下来,请确保您使用rvm:
rvm use 1.9.3
echo $PATH
echo $GEM_PATH # those two need match those from `rvm info`
rvm info

您还可以将一个 ruby 设置为默认值:
rvm use 1.9.3 --default

刷新PATH-输入终端
hash -r # OR:
PATH="$PATH"

甚至重新登录都应该对此有所帮助。

关于ruby - 如何在Debian Linux for ARM上运行 pry ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11820343/

10-12 18:21