作者:黄哥
链接:https://www.zhihu.com/question/48872280/answer/113069376
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

@洛克 说得对
MySQL-python 不支持Python 3。Python 3 可以安装下面的一些库,有多种选择,自己选择一个。
这种问题,搜索即可解决的问题,提问者没有掌握用google。

There are currently a few options for using Python 3 with mysql:

https://pypi.python.org/pypi/mysql-connector-python

  • Officially supported by Oracle
  • Pure python
  • A little slow
  • Not compatible with MySQLdb

https://pypi.python.org/pypi/pymysql

  • Pure python
  • Faster than mysql-connector
  • Almost completely compatible with MySQLdb, after calling pymysql.install_as_MySQLdb()

GitHub - nakagami/CyMySQL: CyMySQL: Python MySQL Client powered by Cython

  • fork of pymysql with optional C speedups

https://pypi.python.org/pypi/mysqlclient

  • Django's recommended library.
  • Friendly fork of the original MySQLdb, hopes to merge back some day
  • The fastest implementation, as it is C based.
  • The most compatible with MySQLdb, as it is a fork

benchmarks here: GitHub - methane/mysql-driver-benchmarks

09-07 05:01