关于pycharm django报错Did you install mysqlclient?

django运行报错:
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?
关于pycharm django报错Did you install mysqlclient?_第1张图片
1.如果没有安装mysqlclient:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient
访问该网页,找到适合自己版本的mysqlclient
关于pycharm django报错Did you install mysqlclient?_第2张图片
下载之后通过pip工具进行安装:在cmd窗口下运行pip install mysqlclient-1.4.6-cp38-cp38-win_amd64.whl(本人下载的是1.4.6版本)
2.已经安装好了的:出现以下情况,明明已经显示有mysqlclient。但还是运行错误出现Did you install mysqlclient?
关于pycharm django报错Did you install mysqlclient?_第3张图片
在这里推荐一种方法:

首先在根目录下的setting.py---->DATABASES添加**
OPTIONS’:{‘isolation_level’:None},
然后同样是在根目录下的_ini_.pyl添加

import pymysql
pymysql.version_info = (1, 4, 6, ‘final’, 0)
pymysql.install_as_MySQLdb()

还要安装pymysql

详细请见
https://blog.csdn.net/xm_QUQ/article/details/101780159?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522158462745819724839238682%2522%252C%2522scm%2522%253A%252220140713.130056874…%2522%257D&request_id=158462745819724839238682&biz_id=0&utm_source=distribute.pc_search_result.none-task

https://www.jianshu.com/p/9d94bf43d302
亲测有效
希望对大家有帮助!!!

你可能感兴趣的:(关于pycharm django报错Did you install mysqlclient?)