SQLite版本过低,Django运行不起来
方法一:脚本模式
vim SQLite_update.sh
wget https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz
tar -xaf sqlite-autoconf-3350500.tar.gz
cd sqlite-autoconf-3350500/
./configure --prefix=/usr/local/
make && make install
mv /usr/bin/sqlite3 /usr/bin/sqlite3.bak
ln -s /usr/local/bin/sqlite3 /usr/bin/sqlite3
echo export LD_LIBRARY_PATH="/usr/local/lib">> ~/.bashrc
source ~/.bashrc
sqlite3 --version
sqlite3 --version
chmod +x SQLite_update.sh
sh SQLite_update.sh
如果安装新版未同步到python3中
进入sqlite3目录执行
cp sqlite3 /usr/bin/sqlite3
方法二:命令行
下载源码包: wget https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gz(这里上官网https://www.sqlite.org自己找一下)
解压: tar -zxvf sqlite-autoconf-3350500.tar.gz
进入到目录:cd sqlite-autoconf-3350500
初始化并编译安装:
./configure --prefix=/usr/local/
make && make install
重命名并软链:
mv /usr/bin/sqlite3 /usr/bin/sqlite3.bak
ln -s /usr/local/bin/sqlite3 /usr/bin/sqlite3
配置环境变量并生效:
echo export LD_LIBRARY_PATH="/usr/local/lib">> ~/.bashrc
source ~/.bashrc
检查版本:
sqlite3 --version
输出结果:
如上输出结果即为成功,然后运行python3 manage.py runserver 0.0.0.0:8000发现不会报错了
如果还是报错可以退出当前链接重新进入,或者新开个链接都可以