我刚刚安装了Ruby gem" sqlite3"对于带有命令的窗口
>gem install sqlite3 --platform=ruby -- --with-sqlite3-include=c:/sqlite3/include --with-sqlite3-lib=c:/sqlite3/lib --with-sqlite3-dir=c:/sqlite3/bin
它看起来很完美,但当我尝试包含我得到的宝石时:
irb(main):001:0> require "sqlite3" LoadError: 126: The specified module could not be found. - C:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.9/lib/sqlite3/sqlite3_native.so from C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' from C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' from C:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.9/lib/sqlite3.rb:6:in `rescue in ' from C:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.9/lib/sqlite3.rb:2:in `' from C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `require' from C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require' from C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:144:in `require' from (irb):1 from C:/Ruby200/bin/irb:12:in `'
所以我检查了它给出的路径" sqlite3_native.so"瞧,那就是它!就像它应该是的那样。那么为什么Ruby会骗我?我怎样才能找出真正的为什么宝石没有工作的原因?
我手动构建gem的原因是预构建的gem带有过时的SQLite3版本
答案 0 :(得分:1)
基本上我在this answer的 HEADS UP 部分找到了答案。
“sqlite3.dll”和“sqlite3.def”需要放在PATH
的某处。我将它们复制到“C:\ Ruby200 \ bin”中,现在我可以成功require "sqlite3"
。我必须说,这是来自Ruby的一个非常无益的错误消息的例子。
答案 1 :(得分:1)
在路径上具有sqlite3.dll和sqlite3.def并没有帮助。将其放在<install path>\Ruby25-x64\bin
内很有帮助。