我试图在由 RVM 控制的 Ruby 1.8.7 中加载 sqlite3 库。但我不能。
情况如下
watanabe@linux:~$ rvm use 1.8.7
Using /home/watanabe/.rvm/gems/ruby-1.8.7-p371
watanabe@linux:~$ ruby -v
ruby 1.8.7 (2012-10-12 patchlevel 371) [x86_64-linux]
watanabe@linux:~$ gem list
*** LOCAL GEMS ***
bundler (1.3.5)
bundler-unload (1.0.1)
rake (10.0.4)
rubygems-bundler (1.2.0)
rvm (1.11.3.8)
sqlite3 (1.3.7)
sqlite3-ruby (1.3.3)
watanabe@linux:~$ gem -v
1.8.25
watanabe@linux:~$ irb
1.8.7 :001 > require 'sqlite3'
LoadError: no such file to load -- sqlite3
from (irb):1:in `require'
from (irb):1
1.8.7 :002 > exit
watanabe@linux:~$ ls -lA .rvm/gems/ruby-1.8.7-p371/gems/sqlite3-1.3.7/lib/
total 8
drwxrwxr-x 2 watanabe watanabe 4096 Jun 5 17:02 sqlite3
-rw-r--r-- 1 watanabe watanabe 249 Jun 5 17:02 sqlite3.rb
watanabe@linux:~$ ls -lA .rvm/gems/ruby-1.8.7-p371/gems/sqlite3-ruby-1.3.3/lib/
total 4
drwxrwxr-x 2 watanabe watanabe 4096 Jun 5 17:37 sqlite3
我认为 sqlite3 gem 安装正确。但我无法加载 sqlite3。你知道这个问题的任何解决方案吗?
注意:它适用于 Ruby 1.9.3。
watanabe@linux:~$ rvm use 1.9.3
Using /home/watanabe/.rvm/gems/ruby-1.9.3-p429
watanabe@linux:~$ ruby -v
ruby 1.9.3p429 (2013-05-15 revision 40747) [x86_64-linux]
watanabe@linux:~$ gem list
*** LOCAL GEMS ***
bundler (1.3.5)
bundler-unload (1.0.1)
rake (10.0.4)
rubygems-bundler (1.2.0)
rvm (1.11.3.8)
sqlite3 (1.3.7)
watanabe@linux:~$ irb
1.9.3p429 :001 > require 'sqlite3'
=> true