質問するログイン新規登録

回答編集履歴

1

具体的な手順を掲載

2018/03/02 05:21

投稿

read_blue2
read_blue2

スコア13

answer CHANGED
@@ -1,4 +1,79 @@
1
1
  Ruby 2.4.3-2をインストールしなおし、再度環境構築をしたら、できるようになりました。
2
2
  (著者の方のサポート有)
3
3
 
4
+ 以下に教えていただいた手順を転載します。
5
+
6
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7
+ 2.5ではだめでしたが、2.4.3では動作しましたので、お知らせしておきます。
8
+
9
+ 1)Windows 10(32bit)(たぶん64bitでも違いはないと思います)
10
+ 2)RubyInstallersから、Ruby 2.4.3-2をダウンロードしてインストール
11
+ ご自身のWindowが64ビットなら、(x64) の方をインストールしてください。
12
+ (最後に要求されるMSYS2のインストールも実施します)
13
+ 3)コマンドプロンプトでコマンドを確認
14
+ ruby --version
15
+ ruby 2.4.3p205 (2017-12-14 revision 61247) [i386-mingw32]
16
+ 4)コマンドプロンプトで下記の順序でインストール
17
+
18
+ C:\Users\kuboaki>gem install sqlite3
19
+ Fetching: sqlite3-1.3.13-x86-mingw32.gem (100%)
20
+ Successfully installed sqlite3-1.3.13-x86-mingw32
21
+ Parsing documentation for sqlite3-1.3.13-x86-mingw32
22
+ Installing ri documentation for sqlite3-1.3.13-x86-mingw32
23
+ Done installing documentation for sqlite3 after 2 seconds
24
+ 1 gem installed
25
+
26
+ C:\Users\kuboaki>gem install dbd-sqlite3
27
+ Fetching: sqlite3-ruby-1.3.3.gem (100%)
28
+
29
+ #######################################################
30
+
31
+ Hello! The sqlite3-ruby gem has changed it's name to just sqlite3. Rather than
32
+ installing `sqlite3-ruby`, you should install `sqlite3`. Please update your
33
+ dependencies accordingly.
34
+
35
+ Thanks from the Ruby sqlite3 team!
36
+
37
+ <3 <3 <3 <3
38
+
39
+ #######################################################
40
+
41
+ Successfully installed sqlite3-ruby-1.3.3
42
+ Fetching: deprecated-2.0.1.gem (100%)
43
+ Successfully installed deprecated-2.0.1
44
+ Fetching: dbi-0.4.5.gem (100%)
45
+ Successfully installed dbi-0.4.5
46
+ Fetching: dbd-sqlite3-1.2.5.gem (100%)
47
+ Successfully installed dbd-sqlite3-1.2.5
48
+ Parsing documentation for sqlite3-ruby-1.3.3
49
+ Installing ri documentation for sqlite3-ruby-1.3.3
50
+ Parsing documentation for deprecated-2.0.1
51
+ Installing ri documentation for deprecated-2.0.1
52
+ Parsing documentation for dbi-0.4.5
53
+ Installing ri documentation for dbi-0.4.5
54
+ Parsing documentation for dbd-sqlite3-1.2.5
55
+ Installing ri documentation for dbd-sqlite3-1.2.5
56
+ Done installing documentation for sqlite3-ruby, deprecated, dbi, dbd-sqlite3 after 4 seconds
57
+ 4 gems installed
58
+
59
+ 5)サンプルプログラムを実行
60
+
61
+ C:\Users\kuboaki>ruby ex2201.rb
62
+
63
+ 0. 蔵書データベースの初期化
64
+ 1. 蔵書データの登録
65
+ 2. 蔵書データの表示
66
+ 9. 終了
67
+ 番号を選んでください(0,1,2,9):9
68
+
4
- ありがとうございました。
69
+ 終了しました。
70
+
71
+ 6)irbコマンドでsqlite3パッケージが使えることを確認
72
+
73
+ C:\Users\kuboaki>irb
74
+ irb(main):001:0> require 'sqlite3'
75
+ => true
76
+ irb(main):002:0>
77
+
78
+ パッケージをrequire して、trueが帰ってくれば、
79
+ そのパッケージがロードできていることになります。