最近准备学习一下机器学习,想使用python3.7,但是安装的时候会一直报_sqlite3的问题。
这个困难纠结我我好几天,今天终于解决了,特和大家分享一下。
当时报了2个问题:
1. no mudole named _sqlite3
2. undefined symbol: sqlite3_close_v2
(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/sqlite
$ make && sudo make install
(2)对python3进行重新编译
$ cd Python-3.7.0
$ LD_RUN_PATH=/usr/local/sqlite/lib ./configure LDFLAGS="-L/usr/local/sqlite/lib" CPPFLAGS="-I /usr/local/sqlite/include"
$ LD_RUN_PATH=/usr/local/sqlite/lib make
$ LD_RUN_PATH=/usr/local/sqlite/lib sudo make install
经过上述步骤后,控制台输入python3进入环境
import sqlite3没报错说明ok