带有 MySQL 数据库的 Python 3.4.0
我已经安装了Python 版本 3.4.0,我想用 MySQL 数据库做一个项目.我下载并尝试安装 MySQLdb,但是对于这个版本的 Python 没有成功.
I have installed Python version 3.4.0 and I would like to do a project with MySQL database. I downloaded and tried installing MySQLdb, but it wasn't successful for this version of Python.
有什么建议可以解决这个问题并正确安装吗?
Any suggestions how could I fix this problem and install it properly?
推荐答案
MySQLdb 不支持 Python 3,但它不是 Python 的唯一 MySQL 驱动程序.
MySQLdb does not support Python 3 but it is not the only MySQL driver for Python.
mysqlclient 本质上只是 MySQLdb 的一个分支,合并了 Python 3 支持(和一些其他改进).
mysqlclient is essentially just a fork of MySQLdb with Python 3 support merged in (and a few other improvements).
PyMySQL 是一个纯 python MySQL 驱动程序,这意味着它更慢,但它不需要编译的 C 组件或 MySQL 库和头文件安装在客户端机器上.它支持 Python 3.
PyMySQL is a pure python MySQL driver, which means it is slower, but it does not require a compiled C component or MySQL libraries and header files to be installed on client machines. It has Python 3 support.
另一种选择是简单地使用另一个数据库系统,如 PostgreSQL.
Another option is simply to use another database system like PostgreSQL.
相关文章