`
littie1987
  • 浏览: 130595 次
  • 性别: Icon_minigender_1
  • 来自: 长沙
社区版块
存档分类
最新评论

python连接MySQL

 
阅读更多

 1:安装MySQLdb

      首先要保证已经正确安装了mysql。

     1):下载MySQL-python-1.2.3.tar.gz(具体版本依据python的版本而定)

     2): 解压 tar -zxvf MySQL-python-1.2.3.tar.gz

     3): 编译 ,进入到解压目录MySql-python-1.2.3。执行python setup.py build

     4): 在安装过程中可能会提示缺少setuptools。如果是Linux可以用如下方式安装

          wget https://bootstrap.pypa.io/ez_setup.py -O - | python。

   我在安装中还遇到过错误:

         error: command 'gcc' failed with exit status 1

        解决办法:

        yum install python-devel

        以上都OK之后,继续执行python setup.py build

   5): 执行python setup.py install。

   参考:http://www.redicecn.com/html/Python/20110417/250.html

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics