django.db.migrations.exceptions.MigrationSchemaMissing和raise ImproperlyConfigured('mysqlclient 1.3.1

1.使用Python3.7 + Django2.2 + MySQL 5.5 在執行(python manage.py migrate)命令時出現錯誤django.db.migrations.exceptions.MigrationSchemaMissinghtml

緣由是python

 

 因此,須要從新安裝高版本的sql,安裝好以後,問題就解決了mysql

 

 

2.Django數據同步過程當中遇到的問題:sql

1)raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__)django

   django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.ui

  解決辦法:C:\Python37\Lib\site-packages\django\db\backends\mysql(python安裝目錄)打開base.py,註釋掉如下內容:.net

        if version < (1, 3, 13):code

          raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__)htm

  

2) File "C:\Python37\lib\site-packages\django\db\backends\mysql\operations.py", line 146, in last_executed_queryblog

    query = query.decode(errors='replace')

  AttributeError: 'str' object has no attribute 'decode'

  解決辦法:打開此文件把146行的decode修改成encode

 

參考

https://blog.csdn.net/qq_36963372/article/details/82558085

https://www.cnblogs.com/olivertian/p/10919550.html

相關文章
相關標籤/搜索