Upgrade SQLite on Ubuntu and let Python use the new version of SQLite

Source: Internet
Author: User
Tags sqlite sqlite download

(This article applies to Debian-based Linux, such as Ubuntu, Raspbian, and so on.) )

On Linux, Python's sqlite3 module uses the system's own SQLite engine , but the system comes with a version of SQLite that is too old.

Look at the version of the SQLite engine with sqlite3.sqlite_version, and find out that this version was released in June 2012:

To upgrade the SQLite engine to a new version and be used by Python, the following two steps are required:

1, first download, compile, install SQLite engine

To the website of sqlite download page: https://www.sqlite.org/download.html Here is the latest version, we will install it.

Source code has two files, we next second (sqlite-autoconf-3160200.tar.gz), because this has a configuration file. Copy its link, and then execute it at the terminal:

wget https:// www.sqlite.org/2017/sqlite-autoconf-3160200.tar.gz Tar ZXVF Sqlite-autoconf-3160200.tar . GZ   sqlite-autoconf-3160200./configuremakesudo make Install

When installed by default, the compiled binaries are installed to/usr/local/lib, the head file Sqlite3.h sqlite3ext.h installed to/usr/local/include, and we need to know both paths.

2. Download, compile, install Python

Please do it according to this article: http://www.cnblogs.com/infopi/p/update_python_raspbian.html

The only difference is that it is slightly different at compile time. Let's say we're installing Python 3.5:

CD./python-3.5.3./configure--prefix=/opt/python3.5makemakesudo make Install

To change to:

CD./python-3.5.3ld_run_path=/usr/local/lib   --prefix=/opt/python3.5ld_run_path=/usr/local/ Lib makemakesudo make install

The blue word is more than the above, indicating that Python will go to those two directories to find SQLite.

After this installation, you can already use the latest version of SQLite, which was released in January 2017:

This article refers to the method on the StackOverflow, to express appreciation ~

In case, the method of this article does not work, can sudo apt-get remove sqlite3 libsqlite3-dev, and then try again.

Upgrade SQLite on Ubuntu and let Python use the new version of SQLite

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.