码迷,mamicode.com
首页 > 数据库 > 详细

python-MySQLdb接口程序安装

时间:2017-06-16 23:10:32      阅读:349      评论:0      收藏:0      [点我收藏+]

标签:程序   python   import   

centos 7,python2.7 安装python-MySQLdb,因是最小化安装,安装过程中需要依赖其他的工具或包

[root@localhost ~]# pipinstall mysql-python

报错:Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-Gme83P/mysql-python/

通过yum 安装以下两个包;

[root@localhost ~]# yum install mysql-devel

[root@localhost ~]# yum installpython-devel

再执行安装,出现以下报错,需要安装gcc编译工具,

Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__=‘/tmp/pip-build-U2yiQI/mysql-python/setup.py‘;f=getattr(tokenize, ‘open‘, open)(__file__);code=f.read().replace(‘\r\n‘, ‘\n‘);f.close();exec(compile(code, __file__, ‘exec‘))" install --record /tmp/pip-iogwbL-record/install-record.txt --single-version-externally-managed --compile"failed with error code 1 in /tmp/pip-build-U2yiQI/mysql-python/

[root@localhost ~]#yum install gcc

安装pip需要先装setuptools
https://pypi.python.org/pypi/setuptools 

[root@localhost setuptools-36.0.1]# pip install mysql-python

Collecting mysql-python

  Using cached MySQL-python-1.2.5.zip

Installing collected packages: mysql-python

  Running setup.py install for mysql-python ... done


本文出自 “没有你的城市” 博客,谢绝转载!

python-MySQLdb接口程序安装

标签:程序   python   import   

原文地址:http://46231571.blog.51cto.com/10939031/1939139

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!