用于 Python 2.7 的 MySQL

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18887705/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 12:11:05  来源:igfitidea点击:

MySQL for Python 2.7

pythonmysqlsqlitepython-2.7

提问by Servietsky

I'm looking for a tool to use MySQL with Python 2.7 under Windows 7 64 bits.

我正在寻找一种在 Windows 7 64 位下使用 MySQL 和 Python 2.7 的工具。

I searched a little bit a found these :

我搜索了一下发现这些:

MySQLdb - _http://sourceforge.net/projects/mysql-python/ 
SQLAlchemy - _http://www.sqlalchemy.org/ 
SQLObject - _http://sqlobject.org/ 
ourSQL - _http://pythonhosted.org/oursql/ 
Connector/Python - _http://dev.mysql.com/downloads/connector/python/1.0.html 
SQLite - _http://www.sqlite.org/ 
Psycopg2 - _http://wiki.postgresql.org/wiki/Psycopg2_Tutorial (postgreSQL)
pandaSQL - _https://github.com/yhat/pandasql 
python-sql - _https://code.google.com/p/python-sql/ 
SnakeSQL - http://pythonweb.org/projects/snakesql/

What do you recommend ?

你有什么建议吗 ?

Thanks !

谢谢 !

Antoine

安托万

采纳答案by Burhan Khalid

Its important to know what you are searching for and the results you pasted:

了解您要搜索的内容和粘贴的结果很重要:

  • MySQLdb- this is a Python driver for MySQL. This is a requirement to use MySQL with Python.
  • SQLAlchemy- this in an object relational mapper. A library used to define database objects in code. By itself, this library cannot connect to any database.
  • SQLObject- this is an alternate object relational mapper.
  • ourSQL- an alternate database driver for MySQL to be used in Python.
  • Connector/Python- a driver for Python from the developers of MySQL.
  • SQLite- this is a file-based database, and has nothing to do with MySQL. Libraries for sqlite are bundled with Python.
  • Psycopg2- this is a driver for postgreSQL, a different database.
  • pandaSQL- this has nothing to do with MySQL but is rather a component for the pandas library.
  • python-sql, this library is only for SQL statements and nothing to do with MySQL.
  • SnakeSQL- this is a database written in Python.
  • MySQLdb- 这是 MySQL 的 Python 驱动程序。这是将 MySQL 与 Python 结合使用的要求。
  • SQLAlchemy- 这在对象关系映射器中。用于在代码中定义数据库对象的库。该库本身无法连接到任何数据库。
  • SQLObject- 这是一个备用的对象关系映射器。
  • ourSQL- 在 Python 中使用的 MySQL 的备用数据库驱动程序。
  • Connector/Python- 来自 MySQL 开发人员的 Python 驱动程序。
  • SQLite- 这是一个基于文件的数据库,与 MySQL 无关。sqlite 的库与 Python 捆绑在一起。
  • Psycopg2- 这是一个不同的数据库 postgreSQL 的驱动程序。
  • pandaSQL- 这与 MySQL 无关,而是Pandas库的一个组件。
  • python-sql,这个库只用于 SQL 语句,与 MySQL 无关。
  • SnakeSQL- 这是一个用 Python 编写的数据库。

Of what you have searched, the recommended library is MySQLdb.

在您搜索的内容中,推荐的库是 MySQLdb

回答by antonone

Try PyMySQLif you want easy installation. It doesn't require any native libraries, its pure python implementation. I wouldn't call it revolutionary or awesome, it just works ;).

如果您想轻松安装,请尝试PyMySQL。它不需要任何本机库,它是纯 python 实现。我不会称它为革命性的或很棒的,它只是有效;)。