要想使python可以操作mysql 就需要MySQL-python驱动,它是python 操作mysql必不可少的模块。

下载地址:https://pypi.python.org/pypi/MySQL-python/

下载MySQL-python-1.2.5.zip 文件之后直接解压。进入MySQL-python-1.2.5目录:

python setup.py install

报错:

[root@centos7 MySQL-python-1.2.4]# python setup.py install

sh: mysql_config: command not found

Traceback (most recent call last):

File "setup.py", line 18, in <module>

metadata, options = get_config()

File "/root/MySQL-python-1.2.4/setup_posix.py", line 43, in get_config

libs = mysql_config("libs_r")

File "/root/MySQL-python-1.2.4/setup_posix.py", line 25, in mysql_config

raise EnvironmentError("%s not found" % (mysql_config.path,))

EnvironmentError: mysql_config not found

网上查了一下需安装mysql-devel 

#yum -y install mysql-devel 

安装成功后

# python setup.py install

安装成功。

[root@centos7 MySQL-python-1.2.5]# python

Python 2.7.5 (default, Jun 17 2014, 18:11:42)

[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> import MySQLdb

/usr/lib64/python2.7/site-packages/MySQL_python-1.2.5-py2.7-linux-x86_64.egg/_mysql.py:3: UserWarning: Module _mysql was already imported from /usr/lib64/python2.7/site-packages/MySQL_python-1.2.5-py2.7-linux-x86_64.egg/_mysql.pyc, but /root/MySQL-python-1.2.5 is being added to sys.path

用安装Python模块出现error: command 'gcc' failed with exit status 1 ,明明装了gcc的,怎么会不行呢,然后发觉是failed不是not found,这说明这个错误个gcc没多大关系,应该是缺少某些功能模块,然后谷歌了一下,先后安装了python-devel,libffi-devel后还是不行,最后发觉要安装openssl-devel才行

可如下命令行安装:

yum install gcc libffi-devel python-devel openssl-devel

centos7 安装mysql--python模块出现EnvironmentError: mysql_config not found和error: command 'gcc' failed with exit status 1的更多相关文章

  1. mysql_config not found和error: command 'gcc' failed with exit status 1

    要想使python可以操作mysql 就需要MySQL-python驱动,它是python 操作mysql必不可少的模块. 下载地址:https://pypi.python.org/pypi/MySQ ...

  2. python安装模块的时候报错error: command 'gcc' failed with exit status 1

    [情况] 在写Python代码的时候,需要用到psutil模块,需要安装. 但是在安装时,报错:error: command 'gcc' failed with exit status 1 [解决步骤 ...

  3. pip安装模块时:error: command 'gcc' failed with exit status 1

    用安装python模块出现error: command 'gcc' failed with exit status 1 问题: gcc编译缺少模块 解决方法: yum install gcc libf ...

  4. Centos4.3安装MySQL-python-1.2.3,出现error: command 'gcc' failed with exit status 1

    在Linux Centos 4.3上安装MySQL-python-1.2.3的时候出现error: command 'gcc' failed with exit status 1, 具体原因是因为没有 ...

  5. python psutil 编译中断。 error: command 'gcc' failed with exit status 1

    error info [root@chenbj psutil-2.0.0]# python setup.py install running install running bdist_egg run ...

  6. python模块安装报错 :error: command 'gcc' failed with exit status 1

    参考:http://blog.csdn.net/fenglifeng1987/article/details/38057193 解决方法 yum install gcc libffi-devel py ...

  7. centos7.2安装paramiko报error: command 'gcc' failed with exit status 1的解决办法

    安装依赖 yum install kernel-devel libxslt-devel libffi-devel python-devel mysql-devel zlib-devel openssl ...

  8. Python 安装出错:Setup script exited with error: command 'gcc' failed with exit status 1

    退出当前环境: logout (再重新登录进去) yum install python-devel  -yyum install libevent-devel  -y 把环境更新下yum instal ...

  9. CentOs安装Scrapy出现error: Setup script exited with error: command ‘gcc’ failed with exit status 1错误解决方案

    按照 http://www.1207.me/archives/209.html 的教程安装Scrapy出现了上述错误,但是本身机器已经有了gcc,所以应该是安装包的问题 百度又看到了同博客里的解决方案 ...

随机推荐

  1. 【LeetCode】数独

    判断一个数独是否合法,未填的空格用字符 ' . ' 表示.该数独有解并不是必要的. e.g. 如图合法数独,输入 ["53..7....","6..195..." ...

  2. “reliable message”事件引发的思考

    今天无意间看到了“reliable message"事件,平时还真没深入研究过这个事件,于是,就收集资料并稍微研究了一下,以下是官方就该事件给出的说明: When you send a me ...

  3. 【转】大型Vuex项目 ,使用module后, 如何调用其他模块的 属性值和方法

    Vuex 允许我们把 store 分 module(模块).每一个模块包含各自的状态.mutation.action 和 getter. 那么问题来了, 模块化+命名空间之后, 数据都是相对独立的, ...

  4. Python学习之路【第二篇】-pyc简介、Python常用的数据类型及其用法和常用运算符

    1.pyc简介 python程序在运行时也有编译过程,编译后会产生.pyc文件.这是一种由python虚拟机执行的二进制文件(字节码),用于保存内存中PyCodeObject,以便加快程序的加载运行. ...

  5. Java并发机制及锁的实现原理

    同步的基本思想 为了保证共享数据在同一时刻只被一个线程使用,我们有一种很简单的实现思想,就是 在共享数据里保存一个锁 ,当没有线程访问时,锁是空的. 当有第一个线程访问时,就 在锁里保存这个线程的标识 ...

  6. Oracle中如何查询一个表的所有字段名和数据类型

    Oracle中如何查询一个表的所有字段名和数据类型 查询语法 select A.COLUMN_NAME,A.DATA_TYPE from user_tab_columns A where TABLE_ ...

  7. Spring Boot整合@Scheduled定时计划

    原文地址:https://blog.csdn.net/justry_deng/article/details/80666508 修改部分: SpringBoot集成了@Scheduled的相关依赖(o ...

  8. RWCString 定义 memeroy leak

    代码截取片段: testDefs.hh class testDefs { public: static const RWCString testStr; }; testDefs.cc const RW ...

  9. 转【面向代码】学习 Deep Learning(二)Deep Belief Nets(DBNs)

    [面向代码]学习 Deep Learning(二)Deep Belief Nets(DBNs) http://blog.csdn.net/dark_scope/article/details/9447 ...

  10. DLL的Export和Import及extern "C"

    今天使用Unrar.dll,在调用RARProcessFileW时,VS总是提示“error LNK2001: 无法解析的外部符号”. Unrar.dll中是使用 extern "C&quo ...