Properly install sqlite3 with FTS5 support

前端 未结 3 686
误落风尘
误落风尘 2021-01-19 13:58

I\'m developing a Python tool which uses a sqlite3 virtual table with FTS5 (Full Text Search). I would like to know how to properly install from a tarball (or any other mean

3条回答
  •  悲&欢浪女
    2021-01-19 14:13

    Thank you for your answers @urban and @saaj. I found your answers constructive.

    The problem I see to @saaj answer is that it requires extra packages, specifically apsw package, which is not compatible with pypy, for example. I could not manage to make it work, but may be my fault.

    I really like @urban answer. I did the process and got it working. I marked this answer as correct.

    However I would like to add my own answer. Is quite aggressive but it worked for me. I created an Ubuntu docker with the following Dockerfile:

    FROM ubuntu:16.04
    RUN apt-get update -y
    RUN DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get install -y apt-utils tzdata
    RUN DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true dpkg-reconfigure tzdata
    RUN echo "Europe/Berlin" > /etc/timezone
    RUN dpkg-reconfigure -f noninteractive tzdata
    RUN apt-get update -y
    RUN apt-get install -y git build-essential sudo
    

    Afterwards, inside the Ubuntu docker I did. In the process I remove sqlite3 and installed its dependencies, that I found in the following article. Afterwards I reinstalled python.

    sudo apt-get update -y
    echo "[ - Removing sqlite3... ]"
    sudo apt-get remove -y sqlite3
    sudo apt-get purge -y sqlite3
    echo "[ - Installing sqlite3 dependencies... ]"
    sudo apt-get install -y build-essential bzip2 git libbz2-dev libc6-dev libgdbm-dev libgeos-dev liblz-dev liblzma-dev libncurses5-dev libncursesw5-dev libreadline6 libreadline6-dev libsqlite3-dev libssl-dev lzma-dev python-dev python-pip python-software-properties python-virtualenv software-properties-common sqlite3 tcl tk-dev tk8.5-dev wget
    echo "[ - Installing sqlite3... ]"
    sudo wget "https://www.sqlite.org/src/tarball/sqlite.tar.gz?r=release" -O sqlite.tar.gz &> /dev/null
    sudo tar -xzvf sqlite.tar.gz
    cd sqlite
    sudo ./configure --enable-fts5
    sudo make
    sudo make install
    cd ..
    echo "[ - Reinstalling python... ]"
    sudo apt-get remove -y python python3 python-dev
    sudo apt-get install -y --reinstall python2.7 python3 python-dev
    sudo apt-get install -y build-essential bzip2 git libbz2-dev libc6-dev libgdbm-dev libgeos-dev liblz-dev liblzma-dev libncurses5-dev libncursesw5-dev libreadline6 libreadline6-dev libsqlite3-dev libssl-dev lzma-dev python-dev python-pip python-software-properties python-virtualenv software-properties-common sqlite3 tcl tk-dev tk8.5-dev wget
    

提交回复
热议问题