如何将sqlite 3.8.2升级到> = 3.8.3 [英] How to upgrade sqlite 3.8.2 to >= 3.8.3
问题描述
在使用Python 3.7.2的虚拟环境中,我试图运行django的 python manage.py startap myapp
,并且出现此错误:
In a virtual Env with Python 3.7.2, I am trying to run django's python manage.py startap myapp
and I get this error:
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.8.2).
我正在运行Ubuntu Trusty 14.04 Server。
I'm running Ubuntu Trusty 14.04 Server.
如何将我的sqlite版本升级或更新为> = 3.8.3?
How do I upgrade or update my sqlite version to >=3.8.3?
我运行
$ apt list --installed | grep sqlite
libaprutil1-dbd-sqlite3/trusty,now 1.5.3-1 amd64 [installed,automatic]
libdbd-sqlite3/trusty,now 0.9.0-2ubuntu2 amd64 [installed]
libsqlite3-0/trusty-updates,trusty-security,now 3.8.2-1ubuntu2.2 amd64 [installed]
libsqlite3-dev/trusty-updates,trusty-security,now 3.8.2-1ubuntu2.2 amd64 [installed]
python-pysqlite2/trusty,now 2.6.3-3 amd64 [installed]
python-pysqlite2-dbg/trusty,now 2.6.3-3 amd64 [installed]
sqlite3/trusty-updates,trusty-security,now 3.8.2-1ubuntu2.2 amd64 [installed]
和
sudo apt install --only-upgrade libsqlite3-0
Reading package lists... Done
Building dependency tree
Reading state information... Done
libsqlite3-0 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 14 not upgraded.
编辑:
settings.py
是股票标准:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
推荐答案
如果您不想重新编译Python,而您将使用virtualenv,您可以在不影响整个系统的情况下进行设置(我已经在Ubuntu 16上做到了这一点):
If you don't want to recompile Python and you're going to be using a virtualenv, you can do this to set it up without affecting the system as a whole (I've done this with Ubuntu 16):
- 从 https://www.sqlite.org/download.html 下载SQLite压缩包
- 提取内容并将cd放入文件夹。
-
运行以下命令:
- Download SQLite tarball from https://www.sqlite.org/download.html
- Extract the contents and cd into the folder.
Run the following commands:
./configure
./configure
sudo make install
sudo make install
现在,您需要编辑用于启动的激活脚本virtualenv,以便python在正确的位置查找新安装的SQLite。只需在文件顶部添加以下行:
Now you need to edit the activate script used to start the virtualenv so that python looks in the right place for the newly installed SQLite. Simply add the following line at the top of the file:
export LD_LIBRARY_PATH = / usr / local / lib
export LD_LIBRARY_PATH="/usr/local/lib"
现在,激活后,Django 2.2+应该可以在virtualenv中正常工作。希望有帮助。
Now, when active, Django 2.2+ should work fine in the virtualenv. Hope that helps.
这篇关于如何将sqlite 3.8.2升级到> = 3.8.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!