SQLite 安裝
SQLite 的一個重要的特性是零配置的,這意味著不需要複雜的安裝或管理。本章將說明 Windows、Linux 和 Mac OS X 上的安裝設定。
在 Windows 上安裝 SQLite
請造訪 SQLite 下載頁面,從 Windows 區下載預先編譯的二進位檔案。
您需要下載 sqlite-shell-win32-*.zip 和 sqlite-dll-win32-*.zip 壓縮檔案。
建立資料夾 C:\sqlite,並在此資料夾下解壓縮上面兩個壓縮文件,將得到 sqlite3.def、sqlite3.dll 和 sqlite3.exe 文件。
新增 C:\sqlite 到 PATH 環境變量,最後在指令提示字元下,使用 sqlite3 指令,將顯示如下結果。
C:\>sqlite3
SQLite version 3.7.15.2 2013-01-09 11:53:05
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>
SQLite version 3.7.15.2 2013-01-09 11:53:05
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>
在Linux 上安裝SQLite
#目前,幾乎所有版本的LinSQLite。所以,只要使用下面的命令來檢查您的機器上是否已經安裝了 SQLite。
$sqlite3
SQLite version 3.7.15.2 2013-01-09 11:53:05
Enter ".help" for instructions
Enter state. "
sqlite>
SQLite version 3.7.15.2 2013-01-09 11:53:05
Enter ".help" for instructions
Enter state. "
sqlite>
如果沒有看到上面的結果,那就代表沒有在Linux 機器上安裝SQLite。因此,讓我們按照下面的步驟安裝 SQLite:
請造訪 SQLite 下載頁面,從原始碼區下載 sqlite-autoconf-*.tar.gz。
步驟如下:
$tar xvfz sqlite-autoconf-3071502.tar.gz
$cd sqlite-autoconf -3071502
$./configure --prefix=/usr/local
$make
$make install
$cd sqlite-autoconf -3071502
$./configure --prefix=/usr/local
$make
$make install
上述步驟將在Linux 機器上安裝SQLite,您可以依照上述講解的進行驗證。
在Mac OS X 上安裝SQLite
最新版本的Mac OS X 會預先安裝SQLite,但如果沒有可用的安裝,只需按照以下步驟進行:
請造訪SQLite 下載頁面,從原始碼區下載sqlite-autoconf-*.tar.gz。
步驟如下:
$tar xvfz sqlite-autoconf-3071502.tar.gz
$cd sqlite-autoconf -3071502
$./configure --prefix=/usr/local
$make
$make install
$cd sqlite-autoconf -3071502
$./configure --prefix=/usr/local
$make
$make install
上述步驟將在Mac OS X 機器上安裝SQLite,您可以使用下列指令進行驗證:
$sqlite3
SQLite version 3.7.15.2 2013-01-09 11:53 :05
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>
SQLite version 3.7.15.2 2013-01-09 11:53 :05
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>
#最後,在SQLite 指令提示字元下,使用做練習。