python - 需要 mysqlclient 1.3.3 或更新版本;你有 0.7.11.None

标签 python mysql django pymysql django-2.0

我使用的是 python 版本 3.6.3 和 django 版本 2.0.1

在cmd中输入py manage.py migrate得到如下结果

(mysqlclient 1.3.3 or newer is required; you have 0.7.11.None)

我试图将 mysql 数据库链接到我的 django 项目。

init.py codes:

import pymysql
pymysql.install_as_MySQLdb()

settings.py codes:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': os.path.join(BASE_DIR, 'mysite'),
        'USER': 'root',
        'PASSWORD': '',
        'HOST': 'localhost',
        'PORT': '8000',
    }
}

最佳答案

删除代码

#import pymysql
#pymysql.install_as_MySQLdb()

安装python包“mysqlclient”

pip install mysqlclient

关于python - 需要 mysqlclient 1.3.3 或更新版本;你有 0.7.11.None,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46670329/

相关文章:

python - 压缩和比较 Python 列表的高效准确方法?

php - 棘手的问题。插入json数据

python - 从 django.db 导入模型,迁移 ImportError : cannot import name migrations

python - 从列表返回值与字典

python - 将 pd.get_dummies 应用于数据帧但改变输出

python - 在运行记录器之前对表进行查询。迁移(django_migrations)?

php - 我应该使用文档数据库重建我的 PHP 网站以提高性能吗?

Django 应用程序,其中数据来自外部 Web 服务而不是数据库

django - 如何从 Excel 文件填充 django Manytomany 数据库

python - 在numpy中将一维数组转换为二维数组