SQLite3 update on my python installation

noob programmer is here, I'm trying to upgrade SQLite3 on my Python installation (I now have version 3.6.11, while I need at least version 3.6.19, since this is the first version that supports foreign keys). Here is my problem: I have no idea how to do this. I know almost nothing about the command line, and I really don't know which files to replace (if at all) on my python installation. And before anyone asks, I already use the latest version of Pysql - this is what is not updated. Can someone give me some pointers or maybe a guide to update this?

I work on Mac OSX 10.5.8, working with python 2.6.

+2
source share
5 answers

I suggest using the pip command on the command line.

pip search sqlite pip install pysqlite 
+2
source

I just came from installing this in both Mavericks and Mountain Lion.

This fooobar.com/questions/169518 / ... article mentions the use of the build_static method, which they say retrieves the latest version of sqlite join. For some reason, this did not work (that is, it does not seem to have downloaded it or used it)

What I finished was

  • Download pysqlite as tarball
  • Last sqlite source merge downloaded
  • Unzip pysqlite to folder
  • Unzip sqlite and copy it to the pysqlite folder
  • Opened setup.cfg and comment out all the directives
  • In the terminal, go to the pysqlite folder, and then:

$ python setup.py build_static install

This compiled pysqlite uses libraries from the latest sqlite sources. And then in Python I used it like:

import pysqlite2.dbapi2 as sqlite3

+1
source

I recently installed python from the source and used the following commands to install both SQLite from the source and Python 2.7.13 from the source.

for SQLite3, you can use the following commands: $ SQLITE_INSTALL_LOCATION

 $ curl -O http://www.sqlite.org/sqlite-autoconf-3070603.tar.gz $ tar xvfz sqlite-autoconf-3070603.tar.gz $ cd sqlite-autoconf-3070603 $ ./configure --prefix=$SQLITE_INSTALL_LOCATION --disable-static CFLAGS="-g" $ make && make install 

Then, when I compiled my python, I edited setup.py in the Python root source

 $ curl -O https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz $ tar xvfz Python-2.7.13.tgz 

Python-2.7.13 / setup.py - add the path to your SQLite installation: `` `

 ... # We hunt for #define SQLITE_VERSION "nnn" # We need to find >= sqlite version 3.0.8 sqlite_incdir = sqlite_libdir = None sqlite_inc_paths = [ '/usr/include', '/usr/include/sqlite', '/usr/include/sqlite3', '/usr/local/include', '/usr/local/include/sqlite', '/usr/local/include/sqlite3', $SQLITE_INSTALL_LOCATION/include, ] ... 

After you have changed setup.py in the python source code, compile and install python, assuming the installation location is $ PYTHON_INSTALL_LOCATION

 $ cd Python-2.7.13 $ LD_RUN_PATH=$SQLITE_INSTALL_LOCATION/lib ./configure --prefix=$PYTHON_INSTALL_LOCATION --enable-shared --enable-unicode=ucs4 $ LD_RUN_PATH=$SQLITE_INSTALL_LOCATION/lib make $ LD_RUN_PATH=$SQLITE_INSTALL_LOCATION/lib make install 

After that, you should have a version of Python with SQLite3 support installed in $ PYTHON_INSTALL_LOCATION / bin / python

Hope this helps!

+1
source

https://pip.pypa.io/en/latest/installing.html

python get-pip.py

python [full path]

python c: \ folder \ get-pip.py

0
source

Disclaimer: I am not a Mac user, but, by all accounts, I give you this information.

You can follow these instructions:

Use Homebrew

As the page shows : If you need to upgrade sqlite, you can use Homebrew .

Homebrew means an additional "program manager." Therefore, you should know how to use it before.

Install it from source

How is this page :

:

 $ tar xvfz sqlite-autoconf-3071502.tar.gz $ cd sqlite-autoconf-3071502 $ ./configure --prefix=/usr/local $ make $ make install 

Either homegrown or source, verfy it

 >>> import sqlite3 >>> sqlite3.version_info (2, 4, 1) >>> sqlite3.sqlite_version_info (3, 6, 11) >>> from pysqlite2 import dbapi2 as sqlite3 >>> sqlite3.version_info (2, 5, 5) >>> sqlite3.sqlite_version_info (3, 6, 18) 

You may need to uninstall the previous version of pysqlite. In any case, you should read this answer in order to better understand the sqlite / python relationship.

0
source

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


All Articles