django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.2.

描述

在升级django版本的过程中,遇到以下问题:

问题一:

 pip3 install --upgrade mysqlclient

/usr/bin/ld: 找不到 –lmariadb

解决方式:

yum install mariadb-libs MariaDB-shared

问题二:

启动django项目后,mysqlclient版本已经是最新版本,项目还是报以下错误

django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.2.

解决方式:

打开base.py(路径为/usr/local/software/Python3.6.6/lib/python3.6/site-packages/django/db/backends/mysql/base.py),注释掉以下内容:        

if version < (1, 3, 13):
     raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__)

二〇二〇年六月十日 14:23:44

点赞