Building Python 2.7.x with sqlite3

I had a requirement to deliver a Python Pyramid WebApp along with own version of python interpreter and the pyramid app should use the python interpreter for its execution.

I have thought that just downloading Python 2.7.x, compiling and installing the python with prefix by providing own location for the python interpreter would just do.

Hence compiled and installed the Python and  run the pyramid app, later to get
import Error: sqlite3.

Yes, that pyramid app uses sqlite3 for managing SQLite based database for user authentication and for some other application related usages.

As the sqlite3 is not installed in the library directory of the newly installed python interpreter, it throws import Error: sqlite3

Later installed sqlite3 in the same location, where the new python interpreter was installed and found still python throws import Error: sqlite3

This is what I have done to install new python interpreter for the pyramid app with sqlite3 for my requirement. Hope it will be useful if you would face similar requirement or error.

$ mkdir -p ~/webpython/src
$ cd ~/webpython/src
$ wget https://www.sqlite.org/2016/sqlite-autoconf-3110100.tar.gz
$ tar xvvf sqlite-autoconf-3110100.tar.gz
$ cd sqlite-autoconf-3110100
$ ./configure --prefix=/<MyHomeDir>/webpython
$ make
$ make install

$ cd ~/webpython/src
$ wget http://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz
$ tar xvvf Python-2.7.11.tgz
$ cd Python-2.7.11
$ ./configure --prefix=~/webpython
$ make
$ make install

$ ~/webpython/bin/python
>>> import sqlite3

>>>

Post a Comment

0 Comments