要想使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

mysql_config not found和error: command 'gcc' failed with exit status 1的更多相关文章

  1. centos7 安装mysql--python模块出现EnvironmentError: 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. pip error: command 'gcc' failed with exit status 1

    SWIG/_m2crypto_wrap.c:127:20: 致命错误:Python.h:没有那个文件或目录     #include <Python.h>                  ...

  3. 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, 具体原因是因为没有 ...

  4. error: command 'gcc' failed with exit status 1

    MacOS下想安装MySQL-Python,执行语句: sudo pip install MySQL-Python 遇到了如下错误信息: /Users/kaitlyn/anaconda3/envs/e ...

  5. 【centos】 error: command 'gcc' failed with exit status 1

    原文连接http://blog.csdn.net/fenglifeng1987/article/details/38057193 用安装Python模块出现error: command 'gcc' f ...

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

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

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

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

  8. 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 ...

  9. pycuda installation error: command 'gcc' failed with exit status 1

    原文:python采坑之路 Setup script exited with error: command 'gcc' failed with exit status 1 伴随出现"cuda ...

随机推荐

  1. hbuilder、hbuilderx和vscode对比

    1. 从内存来对比 1.1 vscode占用内存 打开同一个项目,发现vscode占用内存比较多 1.2 HBuilder占用内存 1.3 HBuilderx占用内存 1.4 对比 从内存上来看,HB ...

  2. 安装redis服务

    wget http://download.redis.io/releases/redis-3.2.6.tar.gz tar -zxvf redis-3.2.6.tar.gzcd redis-3.2.6 ...

  3. Windows Server2012 R2 安装.NET Framework 3.5

    拿到手的虚拟机系统是Windows server 2012R2,本想着安装SQlserver2012轻轻松松,结果途中警告未安装.NET Framework 3.5.于是找了个.NET Framewo ...

  4. Vue学习笔记二:v-cloak,v-text,v-html的使用

    目录 v-cloak:解决插值表达式闪烁问题 安装插件Live Server 右键以HTTP形式运行HTML v-text:以属性方式使用插值表达式 v-cloak和v-text的区别 v-html: ...

  5. mysql之binlog

    binlog 基本认识 MySQL的二进制日志可以说是MySQL最重要的日志了,它记录了所有的DDL和DML(除了数据查询语句)语句,以事件形式记录,还包含语句所执行的消耗的时间,MySQL的二进制日 ...

  6. Mysql 根据一个表数据更新另外一个表

    方法一: update 更新表 set 字段 = (select 参考数据 from 参考表 where  参考表.id = 更新表.id); update table_2 m set m.colum ...

  7. [算法竞赛入门经典]Ancient Cipher, NEERC 2004,UVa1339

    Description Ancient Roman empire had a strong government system with various departments, including ...

  8. python 去除html 超链接href 如何实现?

    今天持久男 在抓取数据的时候发现很多内容都加了锚文本, 这怎么办呢? 没办法只能通过工具解决 我是这样解决的: 例如: soup = BeautifulSoup('<p>Hello < ...

  9. 【vagrant】硬盘扩容

    如题,笔者之前一直在使用vagrant作为虚拟机使用. vagrant的好处自然不必说,只是有一天遇到了一个麻烦事--虚拟硬盘空间不!够!了! 笔者使用了df -h命令一看,结果发现,主硬盘(/dev ...

  10. 第十七节,OpenCV(学习六)图像轮廓检测

    1.检测轮廓 轮廓检测是图像处理中经常用到的,OpenCV-Python接口中使用cv2.findContours()函数查找检测物体的轮廓. cv2.findContours(image, mode ...