1.安装依赖
sudo apt-get install libsqlite3-dev
2.安装sqlite3
wget https://www.sqlite.org/2017/sqlite-autoconf-3170000.tar.gz --no-check-certificate
tar zxvf sqlite-autoconf-3170000.tar.gz
cd sqlite-autoconf-3170000
sudo ./configure --prefix=/usr/local/sqlite3 --disable-static --enable-fts5 --enable-json1 CFLAGS="-g -O2 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_RTREE=1"
3.重新编译python3.6
cd Python-3.6.5
LD_RUN_PATH=/usr/local/sqlite3/lib sudo ./configure --prefix=/opt/python3.6 LDFLAGS="-L/usr/local/sqlite3/lib" CPPFLAGS="-I /usr/local/sqlite3/include"
LD_RUN_PATH=/usr/local/sqlite3/lib sudo make
LD_RUN_PATH=/usr/local/sqlite3/lib sudo make install
检查安装是否成功
cd /opt/python3.6/lib/python3.6/lib-dynload
ls | grep sqlite3
显示下列信息表示安装成功
#_sqlite3.cpython-36m-x86_64-linux-gnu.so
网友评论