Mac查看django的安装路径
python -c "import django; print(django.__path__)"
----------------------------------------
Django版本:2.2 python版本:3.7 pymysql:0.9.3
创建数据库的时候报错:
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/Django-2.2.4-py3.7.egg/django/db/backends/mysql/base.py注释以下内容
#version = Database.version_info #if version < (1, 3, 13): # raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__ )
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/Django-2.2.4-py3.7.egg/django/db/backends/mysql/operations.py
找到operations.py146行
原来是decode的方法,将它改为encode