美文网首页
django2.2 配置mysql问题

django2.2 配置mysql问题

作者: 刘东青_6f21 | 来源:发表于2019-05-25 16:20 被阅读0次

    报错信息:
    File "C:\Users\liuxd\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\mysql\base.py", line 36, in <module

    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.
    进入 C:\Users\liuxd\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\mysql\base.py文件 注释掉报错的35、36行

    再次运行 python manage.py makemigrations

    报错:
    File "C:\Users\liuxd\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\mysql\operations.py", line 146, in
    last_executed_query
    query = query.decode(errors='replace')
    AttributeError: 'str' object has no attribute 'decode'

    进入C:\Users\liuxd\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\mysql\operations.py 修改146行修改为:
    query = query.encode(errors='replace')

    相关文章

      网友评论

          本文标题:django2.2 配置mysql问题

          本文链接:https://www.haomeiwen.com/subject/abkzzqtx.html