Django迁移到mysql数据库时的错误

Posted weibull

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Django迁移到mysql数据库时的错误相关的知识,希望对你有一定的参考价值。

pip install mysqlclient
Collecting mysqlclient
  Using cached https://files.pythonhosted.org/packages/ec/fd/83329b9d3e14f7344d1cb31f128e6dbba70c5975c9e57896815dbb1988ad/mysqlclient-1.3.13.tar.gz
Installing collected packages: mysqlclient
  Running setup.py install for mysqlclient ... error
    Complete output from command c:pythonpython36python.exe -u -c "import setuptools, tokenize;__file__=‘C:\Users\HM\AppData\Local\Temp\pip-install-wjzaxk1g\mysqlclient\setup.py‘;f=getattr(tokenize, ‘open‘, open)(__file__);code=f.read().replace(‘
‘, ‘
‘);f.close();exec(compile(code, __file__, ‘exec‘))" install --record C:UsersHMAppDataLocalTemppip-record-2xdvjr1ginstall-record.txt --single-version-externally-managed --compile:
    c:pythonpython36libdistutilsdist.py:261: UserWarning: Unknown distribution option: long_description_content_type
      warnings.warn(msg)
    running install
    running build
    running build_py
    creating build
    creating buildlib.win-amd64-3.6
    copying _mysql_exceptions.py -> buildlib.win-amd64-3.6
    creating buildlib.win-amd64-3.6MySQLdb
    copying MySQLdb\__init__.py -> buildlib.win-amd64-3.6MySQLdb
    copying MySQLdbcompat.py -> buildlib.win-amd64-3.6MySQLdb
    copying MySQLdbconnections.py -> buildlib.win-amd64-3.6MySQLdb
    copying MySQLdbconverters.py -> buildlib.win-amd64-3.6MySQLdb
    copying MySQLdbcursors.py -> buildlib.win-amd64-3.6MySQLdb
    copying MySQLdb
elease.py -> buildlib.win-amd64-3.6MySQLdb
    copying MySQLdb	imes.py -> buildlib.win-amd64-3.6MySQLdb
    creating buildlib.win-amd64-3.6MySQLdbconstants
    copying MySQLdbconstants\__init__.py -> buildlib.win-amd64-3.6MySQLdbconstants
    copying MySQLdbconstantsCLIENT.py -> buildlib.win-amd64-3.6MySQLdbconstants
    copying MySQLdbconstantsCR.py -> buildlib.win-amd64-3.6MySQLdbconstants
    copying MySQLdbconstantsER.py -> buildlib.win-amd64-3.6MySQLdbconstants
    copying MySQLdbconstantsFIELD_TYPE.py -> buildlib.win-amd64-3.6MySQLdbconstants
    copying MySQLdbconstantsFLAG.py -> buildlib.win-amd64-3.6MySQLdbconstants
    copying MySQLdbconstantsREFRESH.py -> buildlib.win-amd64-3.6MySQLdbconstants
    running build_ext
    building _mysql extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

    ----------------------------------------
Command "c:pythonpython36python.exe -u -c "import setuptools, tokenize;__file__=C:\Users\HM\AppData\Local\Temp\pip-install-wjzaxk1g\mysqlclient\setup.py;f=getattr(t
okenize, open, open)(__file__);code=f.read().replace( , );f.close();exec(compile(code, __file__, exec))" install --record C:UsersHMAppDataLocalTemppip-record-2xdvjr1ginstall-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:UsersHMAppDataLocalTemppip-install-wjzaxk1gmysqlclient

是 缺少插件

可以下载这个网址找到安装包:https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python

Mysqlclient, a fork of the MySQL-python interface for the MySQL database.

pip install mysqlclient 成功!!!

 


以上是关于Django迁移到mysql数据库时的错误的主要内容,如果未能解决你的问题,请参考以下文章

Django 错误:没有名为 _mysql 的模块

Django 迁移错误:字段“名称”没有默认值

恢复 Django-mailer 数据库时出现 MySQL 错误 1118(行大小太大)

Django 从 MySQL 迁移到 Postgres

迁移时重复的列名'model_id'django mysql错误

django迁移数据到mysql时提示异常