首先大概會報一下兩個問題:
1. no mudole named _sqlite3
2.mportError: dynamic module does not define module export function (PyInit__caffe)
其實這兩個問題都是因為python3以上版本不太支持sqlite3沐序,下面的方法是親測沒問題,來自(sparkexpert大神)
(1)安裝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
$ ./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"
(2)對python3進行重新編譯
可能需要修改setup.py這個文件
LD_RUN_PATH=/usr/local/sqlite3/lib ./configure -prefix=/usr/python -enable-shared CFLAGS=-fPIC
./configure -prefix=/usr/python -enable-shared CFLAGS=-fPIC?
make?
make install
$ cd Python-3.6.0a1
$ LD_RUN_PATH=/usr/local/sqlite3/lib ./configure LDFLAGS="-L/usr/local/sqlite3/lib" CPPFLAGS="-I /usr/local/sqlite3/include"
?$ LD_RUN_PATH=/usr/local/sqlite3/lib make
?$ LD_RUN_PATH=/usr/local/sqlite3/lib sudo make install
經(jīng)過上述步驟后良风,應(yīng)該就沒有什么問題了,控制臺輸入python3進入環(huán)境
import sqlite3沒報錯說明ok
轉(zhuǎn)載自:https://www.cnblogs.com/ligh-test/p/10028850.html