• 【linux】CentOS7 升级sqlite3


     

    1、yum remove sqlite3(基本可以不用,后面是直接覆盖的方式)
    2、下载安装包
    sqlite3下载地址:https://www.sqlite.org/download.html
    wget下载:

    wget -O sqlite-3350500.tar.gz   https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz
    
    #-O 另存为名为sqlite-3350500.tar.gz文件
    

    3、解压并安装(依次执行下面命令):

    #1.解压包
    [root@localhost opt]#tar -zxvf sqlite-3350500.tgz.gz  #解压
    
    #2.进入文件包
    [root@localhost opt]#cd sqlite-3350500                     #进入文件包
    
    [root@localhost sqlite-3350500]# ls
    aclocal.m4     config.sub    install-sh     Makefile.am        README.txt  sqlite3.c     sqlite3.pc       sqlite3-sqlite3.o
    compile        configure     libsqlite3.la  Makefile.fallback  Replace.cs  sqlite3ext.h  sqlite3.pc.in    tea
    config.guess   configure.ac  libtool        Makefile.in        shell.c     sqlite3.h     sqlite3.rc
    config.log     depcomp       ltmain.sh      Makefile.msc       sqlite3     sqlite3.lo    sqlite3rc.h
    config.status  INSTALL       Makefile       missing            sqlite3.1   sqlite3.o     sqlite3-shell.o
    
    #3.检测安装路径
    [root@localhost sqlite-3350500]# ./configure --prefix=/usr/local/sqlite3
    
    #4编译及安装
    [root@localhost sqlite-3350500]#make && make install
    

      

    4.查看是否安装成功

    ls -l /usr/local/sqlite3/lib/*sqlite*
    ls -l /usr/local/sqlite3/include/*sqlite*
    

      

    5.替换系统中旧的sqlite

    [root@localhost ~]# mv /usr/bin/sqlite3  /usr/bin/sqlite3_old
    [root@localhost ~]# ln -s /usr/local/sqlite3/bin/sqlite3   /usr/bin/sqlite3
    [root@localhost ~]# echo "/usr/local/sqlite3/lib" > /etc/ld.so.conf.d/sqlite3.conf
    [root@localhost ~]# ldconfig
    

    6.检测版本

    [root@localhost ~]# sqlite3
    SQLite version 3.35.5 2021-04-19 18:32:05
    Enter ".help" for usage hints.
    Connected to a transient in-memory database.
    Use ".open FILENAME" to reopen on a persistent database.
    sqlite> 
    

      

    若是python django 还是提示SQLite版本低

    设置开机自启动执行,可以将下面的export语句写入 ~/.bashrc 文件中,如果如果你想立即生效,可以执行source ~/.bashrc 将在每次启动终端时执行

    #加入环境变量
    [root@localhost ~]# export LD_LIBRARY_PATH="/usr/local/sqlite3/lib"
    
    #重新加载
    [root@localhost ~]#source ~/.bashrc
    

      

    还是不行

    cd /tmp
    wget https://www.sqlite.org/2019/sqlite-autoconf-3280000.tar.gz
    tar xvf sqlite-autoconf-3280000.tar.gz
    mv /usr/bin/sqlite3 /usr/bin/sqlite3.7
    cp /tmp/sqlite-autoconf-3280000/sqlite3 /usr/bin/sqlite3
    cp /tmp/sqlite-autoconf-3280000/.libs/libsqlite3.so.0.8.6 /usr/lib64/libsqlite3.so.0.8.6
    cp /tmp/sqlite-autoconf-3280000/.libs/libsqlite3.so.0 /usr/lib64/libsqlite3.so.0
    

      参考:https://stackoverflow.com/questions/26261080/compile-python-3-4-with-sqlite3

    配置Python环境

    从新编译python3, 唯一的区别是,在编译时略有不同。

    原来的编译过程:

    1 cd /usr/local/src/Python-3.6.4
    2 ./configure --prefix=/usr/local/python3
    3 make && make install

     修改为

    cd /usr/local/src/Python-3.6.4
    LD_RUN_PATH=/usr/local/sqlite3/lib ./configure LDFLAGS="-L/usr/local/sqlite3/lib" CPPFLAGS="-I/usr/local/sqlite3/include"  --prefix=/usr/local/python3
    LD_RUN_PATH=/usr/local/sqlite3/lib make
    make && make install

    特别注意:

    LD_RUN_PATH=/usr/local/sqlite3/lib 此路径是安装sqlite3里文件夹lib路径
  • 相关阅读:
    eclipse生成jar包 注意事项!
    java结合testng,利用XML做数据源的数据驱动示例
    2018 计蒜之道 初赛 第二场
    2018 计蒜之道 初赛 第一场
    Tarjan&&缩点简析
    POJ1159
    POJ1080
    POJ1260
    POJ2533&&1836&&3176
    Luogu P1484 种树
  • 原文地址:https://www.cnblogs.com/JIM-FAN/p/14679461.html
Copyright © 2020-2023  润新知