How to upgrade sqlite3 in python 2.7.3 inside a virtualenv?

后端 未结 3 1136
既然无缘
既然无缘 2020-12-09 23:47

There is a sqlite3 library that comes with python 2.7.3, but it is hardly the latest version.

I would like to upgrade it within a virtualenv environment. In other wo

3条回答
  •  天命终不由人
    2020-12-10 00:00

    I checked setting something like this, works:

    export export LD_LIBRARY_PATH=$HOME//sqlite3/lib
    

    I’ve added it next to the line export PATH in the activate file:

    PATH="$VIRTUAL_ENV/bin:$PATH"
    export PATH
    export LD_LIBRARY_PATH=$HOME/…/sqlite3/lib  # <- Here
    

    One can check it in either one of two ways.

    From Python in the virtualenv, first do:

    >>> import _sqlite3
    >>> _sqlite3.__file__
    '/usr/lib/…/_sqlite3.cpython-35m-i386-linux-gnu.so'
    

    Then exit Python and run ldd on the string returned:

    $ ldd /usr/lib/…/_sqlite3.cpython-35m-i386-linux-gnu.so
    > …
    > libsqlite3.so.0 => /home/…/sqlite3/lib/libsqlite3.so.0
    > …
    

    Or alternatively, again in Python from the virtualenv:

    >>> import sqlite3
    >>> sqlite3.sqlite_version
    '3.21.0'  # Was 3.11.8 before
    

提交回复
热议问题