7.CentOS安装SQLLite3

针对问题Django使用SQLLite问题:

DJANGO.CORE.EXCEPTIONS.IMPROPERLYCONFIGURED: SQLITE 3.9.0 OR LATER IS REQUIRED (FOUND 3.7.17).

1. 创建目录

mkdir -p /opt/local/sqlite && cd /opt/local

2. 下载

#这里上官网https://www.sqlite.org自己找一下
wget wget https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz

3. 解压

tar -zxvf sqlite-autoconf-3350500.tar.gz

4. 编译安装

#指定安装路径
cd sqlite-autoconf-3350500 ./configure --prefix=/opt/local/sqlite
#编译并安装
make && make install

5. 简历软件类

mv /opt/bin/sqlite3 /opt/bin/sqlite3.bak
ln -s /opt/local/sqlite/bin/sqlite3 /usr/opt/sqlite3

6. 配置环境变量并生效

vim /etc/profile  
export LD_LIBRARY_PATH=/usr/local/sqlite/lib
source /etc/profile

7. 检查版本

sqlite3 --version

注意

Django使用更新sqlite后仍然报错

File "/home/ec2-user/django/django/db/backends/sqlite3/base.py", line 210, in get_new_connection
    create_deterministic_function('django_date_extract', 2, _sqlite_datetime_extract)
django.db.utils.NotSupportedError: deterministic=True requires SQLite 3.8.3 or higher    

解决办法

进入/home/ec2-user/django/django/db/backends/sqlite3/base.py,改变功能的变量deterministic=Trueget_new_connection()deterministic=False

你可能感兴趣的:(Linux,centos,sqlite,django)