标签:配置 mamicode django raise exce 版本 ldb 找不到 pack
在使用Django2.0 并配置了mysql作为数据库时,启动报错:
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module. Did you install mysqlclient?
解决方法
项目(settings.py同级)目录中__init__.py中添加
import pymysql
pymysql.install_as_MySQLdb()
raise ImproperlyConfigured(‘mysqlclient 1.3.13 or newer is required; you have %s.‘ % Database.__version__)
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.
解决方法:
找到Python安装路劲下的/Users/MAC/env/MxShop/lib/python3.6/site-packages/django/db/backends/mysql/base.py文件
将文件中的如下代码注释
#if version < (1, 3, 3):
# raise ImproperlyConfigured("mysqlclient 1.3.3 or newer is required; you have %s" % Database.__version__)
重新在项目manage.py路劲下执行如下命令即可
标签:配置 mamicode django raise exce 版本 ldb 找不到 pack
原文地址:https://www.cnblogs.com/superhin/p/12341697.html