how to change ruby version in Pry

↘锁芯ラ 提交于 2019-12-10 16:41:34

问题


My command line ruby is 1.9.2 thanks to RVM, yet when I launch pry (which point to a 1.9.2 gem) it uses ruby 1.8.7

Do you know where is the ruby version pry uses specified ?

macflashy:~ $rvm info
ruby:
  interpreter:  "ruby"
  version:      "1.9.2p290"
  date:         "2011-07-09"
  platform:     "x86_64-darwin11.1.0"
  patchlevel:   "2011-07-09 revision 32553"
  full_version: "ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.1.0]"

homes:
  gem:          "/Users/nrolland/.rvm/gems/ruby-1.9.2-p290"
  ruby:         "/Users/nrolland/.rvm/rubies/ruby-1.9.2-p290"

macflashy:~ $ruby -v
   ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.1.0]

macflashy:~ $ which pry
   /Users/nrolland/.rvm/gems/ruby-1.9.2-p290/bin/pry

macflashy:~ $ pry
  [1] pry(main)> RUBY_VERSION
  => "1.8.7"

回答1:


I don't see how this is possible. Can you do a gist to show that you're using ruby version 1.9 on RVM and yet pry is running 1.8 ?




回答2:


I had the same problem. It looks like you have several versions of ruby on your system. If you don't have the gem pry installed for your current version of ruby, it will fallback to a previously installed version of pry. To do this, it has to run it from a previous version of ruby as well. Like Henry said, try to uninstall pry then reinstall it. In my case, it was never installed for the newer version of ruby. After I installed it, it worked like a charm.




回答3:


Reinstall pry:

sudo gem uninstall pry

sudo gem install pry


来源:https://stackoverflow.com/questions/8026059/how-to-change-ruby-version-in-pry

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!