Linux启动Django项目提示'SQLite 3.8.3 or later is required'

一、背景

1、Python版本:Python 3.6.8
2、Django版本:3,.1.3
3、报错信息

  File "/usr/local/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 70, in 
    check_sqlite_version()
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 67, in check_sqlite_version
    raise ImproperlyConfigured('SQLite 3.8.3 or later is required (found %s).' % Database.sqlite_version)
django.core.exceptions.ImproperlyConfigured: SQLite 3.8.3 or later is required (found 3.7.17).

二、解决方法

1、降级Django版本到django==2.1.7

但这种方法不推荐,依赖太多

2、升级sqlite

(1)安装包下载地址:https://sqlite.org/download.html

(2)下载最新压缩包
wget https://www.sqlite.org/2022/sqlite-autoconf-3390300.tar.gz

(3)解压安装

#解压缩
tar zxvf sqlite-autoconf-3390300.tar.gz
#安装
cd sqlite-autoconf-3390300/
./configure
make & make install

(4)更新版本

# 把旧的sqlite3改个名字
mv /usr/bin/sqlite3  /usr/bin/sqlite3_old

# 设置软链接
ln -s /usr/local/bin/sqlite3 /usr/bin/sqlite3

#查看sqlite3版本
sqlite3 --version

(5)确认版本

#更新前
[root@test-qa-app-01 home]# python3
Python 3.6.8 (default, Nov 11 2020, 18:30:39) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.7.17'

#更新完成后
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.39.3'

你可能感兴趣的:(Linux启动Django项目提示'SQLite 3.8.3 or later is required')