centos 使用pip 安裝mysqldb錯誤

2021-07-31 02:08:45 字數 2846 閱讀 5734

在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,順利完成。

你所浪費的今天是那些死去的人所奢望的明天,你所厭惡的現在是未來的你所回不去的曾經。

centos7下使用docker安裝mysql

若要pull latest mysql version.use docker pull mysql.its ok.在repository屬性下映象名可能為docker.io mysql.為了方便使用mysql直接查詢,可以使用docker tag命令,為docker.io mysql 新增新的映象標...

CentOS 安裝pip教程

root localhost wget no check certificate3.執行get pip.py root localhost python get pip.py4.現在就已經完成了pip的安裝 5.使用pip命令安裝python 沙河環境 root localhost pip inst...

windows7環境下使用pip安裝MySQLd

1 首先,需要確定你已經安裝了pip。在python2.7的安裝包中,easy install.py和pip都是預設安裝的。可以在python的安裝目錄先確認,如果 python27 scripts裡面有pip pip27 pip,就代表已經安裝了pip。2 然後,在doc環境下,在pip所在的目錄...