正确安装具有FTS5支持的sqlite3

编程入门 行业动态 更新时间:2024-10-26 08:29:52
本文介绍了正确安装具有FTS5支持的sqlite3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在开发一个Python工具,该工具使用带有 FTS5 的sqlite3虚拟表(全文搜索).我想知道如何从tarball(或任何其他方式)正确安装工具正常工作所需的要求,以便我可以打包它们以实现可移植性.

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 means) the needed requirements for my tool to work so I can pack them for portability.

当前,我设法安装了最新版本的tarball sqlite .但是,当我执行时:

Currently, I managed to install the latest release tarball of sqlite. However, when I execute:

python3 -c "import sqlite3; print(sqlite3.sqlite_version)" # or python2 -c "import sqlite3; print(sqlite3.sqlite_version)"

我得到3.11.0,而sqlite3 --version返回:3.22.0 2018-01-22 18:45:57 0c55d179733b46d8d0ba4d88e01a25e10677046ee3da1d5b1581e86726f2alt1

系统版本sqlite3 3.22确实支持FTS5,就像我pragma compile_options;并获得:

The system version sqlite3 3.22 does support FTS5, as I do pragma compile_options; and get:

COMPILER=gcc-5.4.0 20160609 ENABLE_DBSTAT_VTAB ENABLE_FTS4 **ENABLE_FTS5** ENABLE_JSON1 ENABLE_RTREE ENABLE_STMTVTAB ENABLE_UNKNOWN_SQL_FUNCTION HAVE_ISNAN THREADSAFE=1

但是,使用此脚本的python版本会返回以下内容:

But, the python version, using this script returns this:

[(u'ENABLE_COLUMN_METADATA',), (u'ENABLE_DBSTAT_VTAB',), (u'ENABLE_FTS3',), (u'ENABLE_FTS3_PARENTHESIS',), (u'ENABLE_JSON1',), (u'ENABLE_LOAD_EXTENSION',), (u'ENABLE_RTREE',), (u'ENABLE_UNLOCK_NOTIFY',), (u'ENABLE_UPDATE_DELETE_LIMIT',), (u'HAVE_ISNAN',), (u'LIKE_DOESNT_MATCH_BLOBS',), (u'MAX_SCHEMA_RETRY=25',), (u'OMIT_LOOKASIDE',), (u'SECURE_DELETE',), (u'SOUNDEX',), (u'SYSTEM_MALLOC',), (u'TEMP_STORE=1',), (u'THREADSAFE=1',)]

因此,我的问题是:

  • 有什么办法可以为我的应用制作linux便携式软件包 在python和linux系统中都支持sqlite3 FTS5?
  • 是否可以将python模块sqlite3链接到特定的 sqlite3路径?
  • Is there any way I could make a linux portable package for my app with sqlite3 FTS5 support in both python and linux system?
  • Is there any way to link the python module sqlite3 to an specific sqlite3 path?
  • 我在Ubuntu 16.04 LTS中尝试了所有这些方法,但是我也希望在CentOS 7上也能正常工作.

    I tried all of this in an Ubuntu 16.04 LTS, but I would like to work as well on CentOS 7.

    非常感谢您.

    有关我从压缩包进行安装的更多详细信息:

    More details about the installation from the tarball that I did:

    wget "www.sqlite/src/tarball/sqlite.tar.gz?r=release" -O sqlite.tar.gz tar -xzvf sqlite.tar.gz cd sqlite ./configure --enable-fts5 make sudo make install

    推荐答案

    我认为这是一个链接问题!我遵循了与您相同的安装步骤,并得到了相同的结果:

    I think is a linking problem! I followed the same install steps with you and got the same results:

    $ python ./test.py [(u'ENABLE_COLUMN_METADATA',), (u'ENABLE_FTS3',), (u'ENABLE_RTREE',), (u'ENABLE_UNLOCK_NOTIFY',), (u'ENABLE_UPDATE_DELETE_LIMIT',), (u'MAX_SCHEMA_RETRY=25',), (u'OMIT_LOOKASIDE',), (u'SECURE_DELETE',), (u'SOUNDEX',), (u'SYSTEM_MALLOC',), (u'TEMP_STORE=1',), (u'THREADSAFE=1',)] NO

    但是,当您在Linux上通过configure/make/make install进行安装时,通常会在/usr/local/lib中使用.为了确保python在运行时针对正确的.so进行链接,我使用了LD_LIBRARY_PATH.在这种情况下,我得到了:

    However, when you install something by configure/make/make install on Linux, it usually goes in /usr/local/lib. To make sure that python links on runtime against the correct .so I used LD_LIBRARY_PATH. In this case I got:

    $ LD_LIBRARY_PATH=/usr/local/lib python ./test.py [(u'COMPILER=gcc-4.8.5',), (u'ENABLE_FTS5',), (u'HAVE_ISNAN',), (u'TEMP_STORE=1',), (u'THREADSAFE=1',)] YES

    此外,在安装库时,您可能必须更新ldconfig.在我的系统上(Ubuntu 14.04):

    Additionally, when installing libraries, you might have to update ldconfig. On my system (Ubuntu 14.04):

    $ sudo ldconfig $ python ./test.py [(u'COMPILER=gcc-4.8.5',), (u'ENABLE_FTS5',), (u'HAVE_ISNAN',), (u'TEMP_STORE=1',), (u'THREADSAFE=1',)] YES

    请注意,不再需要使用LD_LIBRARY_PATH,并且python链接了正确的lib.为此,您需要在ld.so.conf中的某个位置具有/usr/local/lib文件夹...对我来说,该文件夹位于:

    Notice that using LD_LIBRARY_PATH is not needed any more and python links against the correct lib. For this to happen you will need to have /usr/local/lib folder in your ld.so.conf somewhere... for me this is in:

    $ grep -ir local /etc/ld.so.conf.d/ /etc/ld.so.conf.d/libc.conf:/usr/local/lib

    更多推荐

    正确安装具有FTS5支持的sqlite3

    本文发布于:2023-07-03 21:59:53,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1012571.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:正确

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!