如何使用python 3.2安装MySQLdb [英] How to install MySQLdb with python 3.2

查看:188
本文介绍了如何使用python 3.2安装MySQLdb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用python连接到mySQL.据我了解,您需要拥有MySQLdb,它是一些python连接器模块.我的第一个问题是没有正确版本的mySQLdb.可以在此处找到.然后,我应该打开一个命令行窗口并导航到刚下载的文件的路径(解压缩后)并键入python setup.py build.这然后给我一个错误,提示我需要下载安装工具.显然,在python 2.6或7之后,安装工具已终止. >此处,作为替代.我这样做了,现在当我尝试进行构建调用时,它弹出了

I'm trying to connect to mySQL with python. From what I understand you need to have MySQLdb which is some python connector module. My first problem was not having the right version of the mySQLdb. It can be found here. Then I am supposed to open a command line window and navigate to the path of the file I just downloaded (after unzipping) and typepython setup.py build This then gave me an error saying that I needed to downloaded setup tools. Setup tools apparently was discontinued after python 2.6 or 7. Now we are supposed to use distribute, which I found here, as a replacement. I did that and now when I try to make my build call It spits out

Traceback (most recent call last):
  File "setup.py", line 13, in <module>
    from setup_windows import get_config
  File "C:\Program Files\MySQL\MySQL-python-1.2.3\setup_windows.py", line 46
    print """You shouldn't be running this directly; it is used by setip.py."""

Syntax Error: invalid syntax

我需要有人握住我的手,并引导我完成如何进行此设置.我在Google上花了6个小时试图弄清楚. (我在多个地方读到,这是一个困难的安装,但是非常值得.我希望它们是正确的.)

I need someone to hold my hand and walk me through how to get this setup. I've spent 6 hours on google trying to figure it out. (I read in more than one place that it is a difficult install but very worth it. I hope they're right.)

推荐答案

在进一步谷歌搜索之后,我认为使用mysqldb或任何最佳解决方案都不会.我找到了此页面: http://wiki.python.org/moin/MySQL 我决定尝试使用mysql连接器/python.看起来很简单,没有疯狂的安装.

After further googling I don't think that using mysqldb or whatever is the best solution. I found this page: http://wiki.python.org/moin/MySQL I decided to give the mysql connector/python a try. It seems pretty straightforward with no crazy installs.

这篇关于如何使用python 3.2安装MySQLdb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆