Python3.6 用Django鏈接MySQL

Python3.6 用Django鏈接MySQL一直報錯django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 or newer is required; you have 0.7.11.None
百度很久沒解決 ,不知道在哪看到了一個解決方法 貼出來。
錯誤python

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

經過查找路徑C:\Programs\Python\Python36-32\Lib\site-packages\Django-2.0-py3.6.egg\django\db\backends\mysql
這個路徑裏的文件把mysql

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

註釋掉 就好了sql

1.先設置setting.py裏面的配置
2.安裝python的mysql驅動
3.到站點下的init文件加載
import pymysql
pymysql.install_as_MySQLdb()
相關文章
相關標籤/搜索