mysql - 将 Canopy 连接到 mysql

标签 mysql enthought canopy

我是 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: enter image description here

安装完成后,根据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/

相关文章:

mysql - SQL 将行转置为列

php - 使用 simplexml 将 XML 导入 MySQL

python - Ubuntu Server 12.04 上的 llvmpy

php - 我应该为 password_hash() 使用什么列字符编码?

php - 如何根据mysql数据库记录对angularjs中的记录进行分组

python - Traitsui 阻止 txt-box 实时更新

python - 当尝试确定我是否使用 User for Enthought Canapy 时,sys.prefix 生成 "Segmentation fault: 11"

使用 Pdb 进行 Python 调试

python - 如何在 Canopy 的 IPython qtconsole 中使用 Sympy 打印 Latex?

python-2.7 - 在 Mavericks 上安装 gevent(Enthought Canopy python)