Django 1.10.3连接到MySQL 5.7.16 [英] Django 1.10.3 connecting to MySQL 5.7.16

查看:77
本文介绍了Django 1.10.3连接到MySQL 5.7.16的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

环境:Windows 8

Environment: Windows 8

我正在尝试使用Django连接到MySQL。我明白这个模块是需要的:'MySQLdb'。要获得这个模块,我使用 pip安装MYSQL-python easy_install MySQL-Python 。但是我收到以下错误:

I am trying to connect to MySQL using Django. I understand that this module is needed: 'MySQLdb'. To get this module I used pip install MYSQL-python and easy_install MySQL-Python. But I am getting the follwing error:

如何在Windows上为Python安装MySQL支持?

How can I install MySQL support for Python on Windows?

推荐答案

pip install 通常涉及到从头构建库。当一个库包含C代码,有时意味着你需要有头文件可用。

pip install often involves building libraries from scratch. When a library includes C code that sometimes means that you need to have header files available.

虽然可以在Windows上安装Python库,但它可以涉及到位的设置。最后一次在Windows上使用Python时,我最终使用了 Christoph Gohlke的网站的预编译库/ A>。我建议从那里开始。

While it is possible to install Python libraries this way on Windows it can involve quite a bit of setup. The last time I worked with Python on Windows I ended up using precompiled libraries from Christoph Gohlke's website. I recommend starting there.

Christoph提供 mysql-python mysqlclient (支持 mysql-python Python 3)。

Christoph provides both mysql-python and mysqlclient (a fork of mysql-python that supports Python 3).

这篇关于Django 1.10.3连接到MySQL 5.7.16的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆