我是 Python 新手,并使用 Enthought Canopy Express 进行学习。作为其中的一部分,我正在寻找将 Canopy 连接到 mysql 的选项。我没有找到任何 Material 。如果您知道我可以在 Canopy Express 中使用 mysql 的任何方法,请分享。
我使用的是 Mac OS X 版本 10.9
树冠的路径是: /Users/mz/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages
Mysql 是 5.6 版本,路径如下: mysql 是/usr/local/mysql/bin/mysql
最佳答案
您可以使用 Canopy Package Manager 安装pymysql
:
安装完成后,根据Python PEP249 DB API访问pymysql
(创建连接、获取光标等):
In [1]: import pymysql
In [2]: connection = pymysql.connect?
Signature: pymysql.connect(*args, **kwargs)
Docstring:
Establish a connection to the MySQL database. Accepts several
arguments:
host: Host where the database server is located
user: Username to log in as
password: Password to use.
database: Database to use, None to not use a particular one.
port: MySQL port to use, default is usually OK.
...
关于mysql - 将 Canopy 连接到 mysql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37278006/