Building Python 2.5 with full Sqlite3 as a user on Linux

This is a bit of a challenge, at least for me. Here it is:

I work as a user on a Linux server, and I am sure that installing any package that has not yet been installed is simply not possible.

I also need to configure working Python 2.5 (not installed) with the working SQLite3 library (Sqlite is not installed in any form).

What can I do: 1. Compile Python 2.5 and make it work 2. Compile SQLite3 join

In any case, Python 2.5 should interact with the Sqlite3 built-in (pysqlite). This seems plausible, however, importing sqlite3: importing sqlite3 fails because - at the end - it is impossible to import _sqlite3

Some search engines lead me to realize that although pysqlite can be embedded, sqlite is not. Therefore, I suggested that I need to build locally sqlite and somehow make these two software components interact.

Fair enough.

I can - I hope - compile the union to a common object, but it seems messy. Should I rename sqlite3.so to _sqlite3 and throw it away somewhere? This seems a little suspicious, I still tried and got an error: the dynamic module does not detect the init function (init_sqlite3)

At this moment I am a bit stuck. I am not very good at creating / compiling materials. I admit that sudo apt-get / sudo yum made me lazy, but for some reason this is not an option at the moment.

Help rate!

+4
source share
1 answer

First download, install and install sqlite3 using --prefix . Then create python with the same prefix, it will find the sqlite installation and build the _sqlite3 module.

 $ mkdir -p ~/applications/src $ cd ~/applications/src $ wget http://www.sqlite.org/sqlite-autoconf-3070900.tar.gz $ tar xvvf sqlite-autoconf-3070900.tar.gz $ cd sqlite-autoconf-3070900 $ ./configure --prefix=~/applications $ make $ make install $ cd ~/applications/src $ wget http://www.python.org/ftp/python/2.5.2/Python-2.5.2.tgz $ tar xvvf Python-2.5.2.tgz $ cd Python-2.5.2 $ ./configure --prefix=~/applications $ make $ make install $ ~/applications/bin/python >>> import sqlite3 >>> # no error! 
+6
source

Source: https://habr.com/ru/post/1388293/


All Articles