如何在Mac OS上修复mysql django连接?我已经安装了mysqlclient,但是“您安装了mysqlclient吗?”显示错误

时间:2019-05-08 06:04:11

标签: python mysql django database-connection

我正在Mac上使用 MySQL 8.0 设置新的 Django 2.2 项目。我已经安装了mysqlclient和mysql-connector-python。当我按下python manage.py makemigrations时,将显示:

"django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module. Did you install mysqlclient?"

我正在使用python 3.7。 我该如何解决这个问题?

我已经安装了pip install mysqlclient mysql-connector-python

不适用于Python 3.7

import pymysql
pymysql.install_as_MySQLdb()

1 个答案:

答案 0 :(得分:0)

您需要在全局和项目中安装mysqlclient。我认为您应该在PC上全局安装一次,然后尝试