打算爬虫,安装mysqldb 结果使用pip安装出错

在centos-6.4上pip install mysql-python,报错如下[sentry@kjtest111 mysql-python]$ pip install mysql-python

Downloading/unpacking mysql-python

Running setup.py egg_info for package mysql-python

sh: /usr/bin/mysql_config: No such file or directory

Traceback (most recent call last):

File "<string>", line 16, in <module>

File "/tmp/pip-build-sentry/mysql-python/setup.py", line 18, in <module>

metadata, options = get_config()

File "setup_posix.py", line 43, in get_config

libs = mysql_config("libs_r")

File "setup_posix.py", line 25, in mysql_config

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

EnvironmentError: /usr/bin/mysql_config not found

Complete output from command python setup.py egg_info:

sh: /usr/bin/mysql_config: No such file or directory

Traceback (most recent call last):

File "<string>", line 16, in <module>

File "/tmp/pip-build-sentry/mysql-python/setup.py", line 18, in <module>

metadata, options = get_config()

File "setup_posix.py", line 43, in get_config

libs = mysql_config("libs_r")

File "setup_posix.py", line 25, in mysql_config

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

EnvironmentError: mysql_config not found

----------------------------------------

工作环境:centOS6.4

解决方法:1.  通过报错信息看出是缺少mysql_config,在/usr/bin/下面应该有的mysql_config文件没有,网上的解决方案都是apt-get install libmysqlclient-dev,但是apt-get是Debian、Ubuntu系列的网络安装命令,yum是Redhat、Centos、Fedora是网络安装命令,接着发现Centos上应该安装mysql-devel

2.  yum install mysql-devel,发现有冲突,报错如下:

--> Running transaction check

---> Package mysql-devel.x86_64 0:5.1.69-1.el6_4 will be installed

--> Processing Dependency: mysql = 5.1.69-1.el6_4 for package: mysql-devel-5.1.69-1.el6_4.x86_64

--> Running transaction check

---> Package mysql.x86_64 0:5.1.69-1.el6_4 will be installed

--> Processing Conflict: MySQL-client-5.5.30-1.el6.x86_64 conflicts mysql

--> Processing Conflict: MySQL-server-5.5.30-1.el6.x86_64 conflicts mysql

--> Processing Conflict: mysql-5.1.69-1.el6_4.x86_64 conflicts MySQL

--> Finished Dependency Resolution

Error: mysql conflicts with MySQL-devel-5.5.30-1.el6.x86_64

You could try using --skip-broken to work around the problem

You could try running: rpm -Va --nofiles --nodigest

3.  使用 rpm -qa|grep mysql查看mysql的安装情况

mysql-devel-5.5.16-1.el6_4.x86_64

mysql-client-5.5.16-1.el6_4.x86_64

mysql-server-5.5.16-1.el6_4.x86_64

4.  使用rpm -e mysql-devel-5.5.16-1.el6_4.x86_64移除已有的安装包

5.  再次使用yum install mysql-devel 发现和mysql-server, mysql-client的版本有冲突

6.  去网上寻找相同的版本下载http://downloads.skysql.com/archive/index/p/mysql/v/5.5.16,下载64bit的rpm文件,使用rpm -ivh MySQL-devel-5.5.16-1.linux2.6.x86_64.rpm安装

7.  安装成功后,去/usr/bin/目录下,发现生成了mysql_config文件,继续pip install mysql-python,顺利完成。

MySQL缺失mysql_config文件的更多相关文章

  1. Linux下MySQL的数据文件存放位置

    http://bbs.csdn.net/topics/390620630mysql> show variables like '%dir%';+------------------------- ...

  2. Linux下MySQL的数据文件存放在哪里的

    mysql> show variables like '%dir%';+-----------------------------------------+------------------- ...

  3. Linux下MySQL的数据文件存放在哪里的??

    http://bbs.csdn.net/topics/390620630 mysql> show variables like '%dir%';+------------------------ ...

  4. MySQL frm+ibd文件还原data的办法【数据恢复】

    MySQL frm+ibd文件还原data的办法[数据恢复] 此方法只适合innodb_file_per_table          = 1 当误删除ibdata 该怎么办? 如下步骤即可恢复: 1 ...

  5. mysql 有关的文件

    1.在linux上安装好mysql之后,存在很多mysql有关的文件. 2./etc/rc.d/init.d/mysql 是mysql服务的启动脚本,是对mysqld_safe的封装,mysqld_s ...

  6. mysql 的日志文件

    mysql的日志文件 日志文件大致分为  error log, binary log, query log, slow query log, innodb redo log ;如图: 1.error ...

  7. mysql 的数据文件

    mysql的数据文件 由于mysql的数据文件结构主要跟mysql的存储引擎相关,这里不做过多解释,具体查看各个引擎章节的内容 .首先上一段小辉老师的教程; 在MySQL 中每一个数据库都会在定义好( ...

  8. [转载]mysql慢日志文件分析处理

    原文地址:mysql慢日志文件分析处理作者:maxyicha mysql有一个功能就是可以log下来运行的比较慢的sql语句,默认是没有这个log的,为了开启这个功能,要修改my.cnf或者在mysq ...

  9. mysql.cnf 配制文件详解

    代码如下: [client]port = 3306socket = /tmp/mysql.sock [mysqld]port = 3306socket = /tmp/mysql.sock basedi ...

随机推荐

  1. 在iOS中实现类似安卓自动消失提示框

    类方法: + (void)showMessage:(NSString *)message { // 获取window UIWindow *window = [UIApplication sharedA ...

  2. 63-w 简明笔记

    显示关于系统用户的信息 w [options] [username] w用于显示当前登录系统的用户的名字以及他们的终端设备编号.登录时间.正在运行的命令和其他一些信息 参数 username 限定仅显 ...

  3. 解决"415 Cannot process the message because the content type 'application/x-www-form-urlencoded' was not the expected type 'text/xml; charset=utf-8'"

    wcf basicHttpBinding content-type    text/xml;charset=utf-8 wsHttpBinding  'application/soap+xml; ch ...

  4. 屠龙之路_转角遇到服务器大魔王_FourthDay

    Day4:将View打败后,View还送了屠龙团一个信物.于是在今天的旅途中,少年们在遇到View的其他兄弟时,以此信物将他们收于麾下,并借助他们的力量打败了服务器大魔王." Fightin ...

  5. Windows下Php安装mongodb扩展失败

    查看php版本 下载对应的mongodb插件 将php_mongo.dll文件复制到php安装目录下的ext下 重启apache Apache –k restart 浏览器php.info( )测试 ...

  6. 快速向表中插入大量数据Oracle中append与Nologging

    来源于:http://blog.sina.com.cn/s/blog_61cd89f60102e7gi.html 当需要对一个非常大的表INSERT的时候,会消耗非常多的资源,因为update表的时候 ...

  7. C++折半插入排序

    代码如下: #include <iostream> using namespace std; void insertSort(int a[], int n) { for(int i=1;i ...

  8. 最完整的Elasticsearch 基础教程

    翻译:潘飞(tinylambda@gmail.com) 基础概念 Elasticsearch有几个核心概念.从一开始理解这些概念会对整个学习过程有莫大的帮助. 接近实时(NRT)        Ela ...

  9. GIF/PNG/JPG和WEBP/base64/apng图片优点和缺点整理

    GIF/PNG/JPG/WEBP/APNG都是属于位图(位图 ,务必区别于矢量图): GIF/PNG和JPG这三种格式的图片被广泛应用在现今的互联网中,gif曾在过去互联网初期慢速的情况下几乎是做到了 ...

  10. 数据库开发基础-SQl Server 主键、外键、子查询(嵌套查询)

    主键 数据库主键是指表中一个列或列的组合,其值能唯一地标识表中的每一行.这样的一列或多列称为表的主键,通过它可强制表的实体完整性.当创建或更改表时可通过定义 PRIMARY KEY约束来创建主键.一个 ...