• Django连接MySQL出错


    错误一:No module named 'MySQLdb'

    原因:python3连接MySQL不能再使用mysqldb,取而代之的是pymysql。

    解决方法:在python的MySQL包中,即路径:C:UsersadongAppDataLocalProgramsPythonPython36Libsite-packagesDjango-2.0.3-py3.6.eggdjangodbackendsmysql

    下的__init__.py文件中加入:

    import pymysql

    pymysql.install_as_MySQLdb()

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

    原因:在解决了错误一以后出现了此错误。

    解决方法:在python的MySQL包中,即路径:C:UsersadongAppDataLocalProgramsPythonPython36Libsite-packagesDjango-2.0.3-py3.6.eggdjangodbackendsmysql

    下的 base.py 文件中,注释掉一下两行代码:

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

  • 相关阅读:
    Hamming Distance(随机算法)
    Difference Between Primes
    Pet(dfs)
    29. Divide Two Integers
    28. Implement strStr()
    25. Reverse Nodes in k-Group
    24. Swap Nodes in Pairs
    23. Merge k Sorted Lists
    22. Generate Parentheses
    19. Remove Nth Node From End of List
  • 原文地址:https://www.cnblogs.com/ljd4you/p/8592765.html
Copyright © 2020-2023  润新知