【问题标题】:ImproperlyConfigured('SQLite 3.8.3 or later is required (found %s).' % Database.sqlite_version)ImproperlyConfigured('需要 SQLite 3.8.3 或更高版本(找到 %s)。' % Database.sqlite_version)
【发布时间】:2020-07-04 16:47:51
【问题描述】:

ImproperlyConfigured('SQLite 3.8.3 or later is required (found %s).' % Database.sqlite_version) django.core.exceptions.ImproperlyConfigured: SQLite 3.8.3 or later

我在 django 项目中遇到了这个问题,sqlite3 和 django 的版本不匹配。这发生在 centos7 环境中,我还想要一个在容器环境中工作的便捷解决方案。

【问题讨论】:

    标签: python django sqlite


    【解决方案1】:

    我通过使用以下命令升级我的 sqlite3 版本解决了这个问题:

    cd ~ && wget https://www.sqlite.org/2020/sqlite-autoconf-3320100.tar.gz && tar xvfz sqlite-autoconf-3320100.tar.gz && cd sqlite-autoconf-3320100 && ./configure && make && make install
    

    我正在使用 ElasticBeanstalk 进行设置,因此我在 .ebextensions 文件夹中添加了一个 .config 文件并将其放入其中:

    option_settings:
      aws:elasticbeanstalk:application:environment:
        LD_LIBRARY_PATH: "/usr/local/lib"
    commands:
      01_upgrade_sqlite:
        command: "cd ~ && wget https://www.sqlite.org/2020/sqlite-autoconf-3320100.tar.gz && tar xvfz sqlite-autoconf-3320100.tar.gz && cd sqlite-autoconf-3320100 && ./configure && make && make install"
    

    非常感谢 Bejür 在此处添加 LD_LIBRARY_PATH 环境变量以使其正常工作。

    【讨论】:

      【解决方案2】:

      在我的情况下,使用kloddant 的说明升级 sqlite 只起到了部分作用。 SQLite 已安装,但 python 仍然指的是旧的 sqlite 版本。

      解决此问题的另一个步骤是设置环境变量LD_LIBRARY_PATH="/usr/local/lib"

      添加到.ebextensions/*.config

      option_settings:
        "aws:elasticbeanstalk:application:environment":
          LD_LIBRARY_PATH: "/usr/local/lib"
      

      【讨论】:

      • 这真的有效吗?我已经尝试过这个以及添加命令command: export LD_LIBRARY_PATH=/usr/local/lib,但我不断收到错误deterministic=True requires SQLite 3.8.3 or higher
      • Elastic Beanstalk 一定发生了一些变化。我的回答当时有效,但现在它停止工作,直到我从你那里添加了这一点。太感谢了!我会将您的答案合并到我的答案中,以供未来的观众观看。
      【解决方案3】:

      你的 SQLite 版本过时了,你可以试试这个:

      python -m pip install -U sqlite
      

      【讨论】:

      • 对不起,我试过了,但这对我不起作用。一样的感谢。
      【解决方案4】:

      我现在找到了一个可用的解决方案:将 Django 的版本从 'Django==3.0.4' 更改为 'Django==2.1.8' 并且它起作用了。

      pip install django==2.1.8 -i https://mirrors.aliyun.com/pypi/simple/

      【讨论】:

      • 降级 Django,虽然它可能有效,但并不是一个很好的选择,充其量只是一个短期修复。
      • 不是,但有时间限制。期待您的卓越解决方案。
      • 我已经发布了。但是,如果我没有找到方法,我会建议使用常规数据库而不是 sqlite。
      猜你喜欢
      • 2020-12-11
      • 2020-08-24
      • 2019-09-04
      • 2020-06-24
      • 2022-11-04
      • 1970-01-01
      • 2022-07-03
      • 2020-06-14
      • 2021-06-26
      相关资源
      最近更新 更多