zoukankan      html  css  js  c++  java
  • Django启动时找不到mysqlclient处理 django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module. Did you install mysqlclient?

    在使用Django2.0 并配置了mysql作为数据库时,启动报错:

    报错1:找不到mysqlclient

    django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module. Did you install mysqlclient?

    解决方法
    项目(settings.py同级)目录中__init__.py中添加

    import pymysql
    pymysql.install_as_MySQLdb()
    

    报错2:版本检查出错

    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路劲下执行如下命令即可

  • 相关阅读:
    lufylegend:图形变形3
    javascript: Math.sin() cos() 用法
    lufylegend:图形变形2
    lufylegend:图形变形1
    lufylegend:图片的加载和显示
    lufylegend基础知识1
    canvas使用3
    canvas使用2
    canvas使用1
    javascript:addEventListener
  • 原文地址:https://www.cnblogs.com/superhin/p/12341697.html
Copyright © 2011-2022 走看看