blackhat591 发表于 2011-11-13 18:07

如何安装sqlite3.gem

window平台,安装这个gem出现问题,谷歌了很多方法都解决不了。
安装这个gem出现问题,已安装sqlite3.
C:\Ruby192>gem install sqlite3-1.3.4.gem --local
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing sqlite3-1.3.4.gem:
ERROR: Failed to build gem native extension.

C:/Ruby192/bin/ruby.exe extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Install SQLite3 from http://www.sqlite.org/ first.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby192/bin/ruby
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
--enable-local
--disable-local


Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/sqlite3-1
.3.4 for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/sqlite3-1.3.4/ext/sqlite3/
gem_make.out

coolesting 发表于 2011-11-14 17:08

下载 http://www.sqlite.org/download.html

的那三个文件
http://www.sqlite.org/sqlite-shell-win32-x86-3070900.zip
http://www.sqlite.org/sqlite-dll-win32-x86-3070900.zip


解压, 并复制文件
    * sqlite3.exe
    * sqlite3.def
    * sqlite3.dll
到你的ruby安装文件夹下, 假设是 c:\ruby\bin 或 (c:\windows\system32)


然后安装
    gem install sqlite3-X.X.X.gem --local

   

如果这个安装有选项, 看情况选, 一般是第一项。


安装是否成功, 进入ruby的irb, 打 require 'sqlite3' 返回 true刚成功

blackhat591 发表于 2011-11-14 17:26

“gem install sqlite3-1.3.4.gem --local”这里是相同的错误。
“进入ruby的irb”是lib目录吧,如下:
C:\Ruby192\lib>require 'sqlite3'
'require' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

btw,没想到你也到这里混,我csdn那位 :D

coolesting 发表于 2011-11-14 17:50

“gem install sqlite3-1.3.4.gem --local”这里是相同的错误。
“进入ruby的irb”是lib目录吧,如下:
C ...
blackhat591 发表于 2011-11-14 17:26 http://bbs.chinaunix.net/images/common/back.gif


    irb 是一个ruby自带的命令, 不是进入lib文件夹
$ irb
irb(main):001:0> require 'sqlite3'
=> true
irb(main):002:0>
页: [1]
查看完整版本: 如何安装sqlite3.gem