MySQL缺失mysql config檔案

2021-09-07 07:52:54 字數 2783 閱讀 3226

打算爬蟲,安裝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 "", line 16, in

file "/tmp/pip-build-sentry/mysql-python/setup.py", line 18, in

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 "", line 16, in

file "/tmp/pip-build-sentry/mysql-python/setup.py", line 18, in

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的版本有衝突

7.  安裝成功後,去/usr/bin/目錄下,發現生成了mysql_config檔案,繼續pip install mysql-python,順利完成。

MySQL 補全缺失的日期

將缺失的日期建立出來 建立乙個表用來儲存0 9的數字 insert into num i values 0 1 2 3 4 5 6 7 8 9 生成0 9的數字,方便以後計算時間 create table ifnot exists calendar datelist date 生成乙個儲存日期的表,...

醫德缺失還是醫術缺失?

這次回老婆老家,看 小豹子 小豹子是我兒子的小名字 我看見他後腦勺上長了乙個小包,像個 癤子 當時我好像當著丈母娘的面,就說了 怎麼這地方長了乙個包 農村的條件真的是很差的,我老婆家三個小孩子,先後讀書,家裡主要靠他爸做磚瓦匠。這點小包一般是不會放在心上的,他們也說這個小包是最近長大了點的。10月2...

Mysql實戰之求出缺失範圍

1.需求 求出缺失範圍 2.示例 根據表中某個變化字段,求出變化欄位的缺失範圍。如下給出乙個例子 下面是乙個表x,其中的資料如下 mysql select from x a 3 4 5 6 100 101 102 105 106 107 10 rows in set 0.03 sec 其中的缺失範圍...