zoukankan      html  css  js  c++  java
  • 重构drf项目后的manage.py报错的问题

    Python3.6 用Django连接mysql一直报错django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 or newer is required; you have 0.7.11.None

    百度好久没解决 ,不知道在哪看到了一个解决方法 贴出来。

    错误

    django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 or newer is required; you have 0.7.11.None

    解决方案

    通过查找路径C:ProgramsPythonPython36-32Libsite-packagesDjango-2.0-py3.6.eggdjangodbackendsmysql
    这个路径里的文件把
    if version < (1, 3, 3):
    raise ImproperlyConfigured("mysqlclient 1.3.3 or newer is required; you have %s" % Database.version)

    注释掉

    再不行的话

    找到Python环境下 django包,并进入到backends下的mysql文件夹

    找到base.py文件,注释掉 base.py 中如下部分(35/36行)
    if version < (1, 3, 3):
    raise ImproperlyConfigured("mysqlclient 1.3.3 or newer is required; you have %s" % Database.version)

    AttributeError: ‘str’ object has no attribute ‘decode’

    if query is not None:
    query = query.decode(errors='replace')
    return query

    改为

    if query is not None:
    query = query.encode(errors='replace')
    return query

  • 相关阅读:
    [C++]仿java.lang.String的字符串工具类[原]
    SQL基础1创建表、用户
    Linux中gdb 查看core堆栈信息
    Direct3D9基础工具类[原]
    eclipse3.4启动错误
    ndk连接第三方库
    数据库基本概念
    MySQL常见命令
    MySQL启动和停止
    MySQL配置文件
  • 原文地址:https://www.cnblogs.com/demiao/p/11973402.html
Copyright © 2011-2022 走看看