Стани, стани.. Юнак балкански като българин!

Posts tagged ‘RedHat’

Upgrade SQLite in Python

I tried many different things till figured it out – so this is a guide that might be helpful:

Download:

1)

wget https://pypi.python.org/packages/42/02/981b6703e3c83c5b25a829c6e77aad059f9481b0bbacb47e6e8ca12bd731/pysqlite-2.8.3.tar.gz

2)

wget http://www.sqlite.org/2017/sqlite-amalgamation-3210000.zip

Extract: 1) „pysqlite-2.8.3.tar.gz“ in its own directory; 2.1) then extract the contents of „sqlite-amalgamation-3210000.zip“ twice: once in the same directory where pysqlite was extracted and then in a sub-directory there named: „sqlite3“.

[root@localhost pysqlite-2.8.3]# ll
 total 9932
 drwxr-xr-x. 4 root    root       63 Nov  1 16:13 build
 -rw-r--r--. 1 xtigyro users   13886 Mar 26  2016 cross_bdist_wininst.py
 -rw-r--r--. 1 root    root     9965 Nov  1 16:13 cross_bdist_wininst.pyc
 drwxr-xr-x. 4 xtigyro users      75 Aug 31  2016 doc
 drwxr-xr-x. 3 xtigyro users      69 Aug 31  2016 lib
 -rw-r--r--. 1 xtigyro users     892 Mar 26  2016 LICENSE
 -rw-r--r--. 1 xtigyro users     191 Mar 26  2016 MANIFEST.in
 -rw-r--r--. 1 xtigyro users    1033 Aug 31  2016 PKG-INFO
 drwxr-xr-x. 4 root    root       40 Nov  1 16:15 pysqlite283_sqlite321
 -rw-r--r--. 1 xtigyro users      66 Mar 26  2016 setup.cfg
 -rw-r--r--. 1 xtigyro users    8171 Mar 26  2016 setup.py
 -rw-r--r--. 1 root    root   265164 Nov  1 16:11 shell.c
 drwxr-xr-x. 2 root    root       75 Oct 24 22:26 sqlite3
 -rw-r--r--. 1 root    root  7218143 Nov  1 16:11 sqlite3.c
 -rw-r--r--. 1 root    root    31022 Nov  1 16:11 sqlite3ext.h
 -rw-r--r--. 1 root    root   510272 Nov  1 16:11 sqlite3.h
 -rw-r--r--. 1 root    root  2078004 Nov  1 15:29 sqlite-amalgamation-3210000(1).zip
 drwxr-xr-x. 2 xtigyro users    4096 Aug 31  2016 src

3) (switch to Python ver. 2.7 from RedHat Software Compilations on RHEL/CentOS)

scl enable python27 bash

4)

python setup.py build_static

5)

mkdir pysqlite283_sqlite321

6)

python setup.py install –home=pysqlite283_sqlite321

7)

cd pysqlite283_sqlite321/lib64/python/

8)

ln -s {pysqlite2,sqlite3}

tar cfvz pysqlite283_sqlite321.tar.gz ./*

cp pysqlite283_sqlite321.tar.gz /opt/rh/python27/root/usr/lib64/python2.7

10)

cd /opt/rh/python27/root/usr/lib64/python2.7

# Optional

mv pysqlite2 pysqlite2-old

mv sqlite3 sqlite3-old

11)

tar xf pysqlite283_sqlite321.tar.gz

# Optional

ln -s {pysqlite2,sqlite3}

 

12) Check the desired result:

[root@localhost python]# python -c ‘from pysqlite2 import dbapi2 as sqlite3; print „lib version:“, sqlite3.version, „| SQLite version:“, sqlite3.sqlite_version’

lib version: 2.8.3 | SQLite version: 3.21.0

Advertisements

Облак от етикети