【问题标题】:mysql-connector-python-2.0.2-py3.3.msi Installation failedmysql-connector-python-2.0.2-py3.3.msi 安装失败
【发布时间】:2015-01-30 08:49:07
【问题描述】:

我想使用“导入 MySQLdb” 所以我下载了 Windows (Architecture Independent), MSI Installer Python 3.3 地址:http://dev.mysql.com/downloads/connector/python/ 安装完成后告诉我安装失败

导入 MySQL 数据库 回溯(最近一次通话最后): 文件“”,第 1 行,在 ImportError:没有名为“MySQLdb”的模块 请告诉我该怎么做。谢谢。

PS:我使用 MySQL Server 5.5 和 python33

【问题讨论】:

    标签: python mysql


    【解决方案1】:

    查看文档中的任何示例,您会发现带有oracle的mysql连接器的模块不是命名为MySQLdb,而是简单地命名为mysql(或者更确切地说是mysql.connector):

    import mysql.connector
    
    cnx = mysql.connector.connect(user='scott', password='tiger',
                                  host='127.0.0.1',
                                  database='employees')
    cnx.close()
    

    来自: http://dev.mysql.com/doc/connector-python/en/connector-python-example-connecting.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-12-12
      • 1970-01-01
      • 1970-01-01
      • 2019-02-11
      • 2016-05-12
      • 2017-12-03
      • 1970-01-01
      • 2012-01-08
      相关资源
      最近更新 更多