在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>",))
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,顺利完成。