问题
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