entos下用pip安装mysql_python报错

 

[plain] view plain copy
 
  1.   Running setup.py egg_info for package mysql-python  
  2.     sh: mysql_config: command not found  
  3.     Traceback (most recent call last):  
  4.       File "<string>", line 16, in <module>  
  5.       File "/tmp/pip-build/mysql-python/setup.py", line 18, in <module>  
  6.         metadata, options = get_config()  
  7.       File "setup_posix.py", line 43, in get_config  
  8.         libs = mysql_config("libs_r")  
  9.       File "setup_posix.py", line 25, in mysql_config  
  10.         raise EnvironmentError("%s not found" % (mysql_config.path,))  
  11.     EnvironmentError: mysql_config not found  
  12.     Complete output from command python setup.py egg_info:  
  13.     sh: mysql_config: command not found  
  14.   
  15. Traceback (most recent call last):  
  16.   
  17.   File "<string>", line 16, in <module>  
  18.   
  19.   File "/tmp/pip-build/mysql-python/setup.py", line 18, in <module>  
  20.   
  21.     metadata, options = get_config()  
  22.   
  23.   File "setup_posix.py", line 43, in get_config  
  24.   
  25.     libs = mysql_config("libs_r")  
  26.   
  27.   File "setup_posix.py", line 25, in mysql_config  
  28.   
  29.     raise EnvironmentError("%s not found" % (mysql_config.path,))  
  30.   
  31. EnvironmentError: mysql_config not found  
  32.   
  33. ----------------------------------------  
  34. Command python setup.py egg_info failed with error code 1 in /tmp/pip-build/mysql-python  
  35. Storing complete log in /root/.pip/pip.log  

安装mysql-devel后正常运行

yum install mysql-devel

 

如果手工安装mysql_python

在setup_posix.py内找到mysql_config.path

变成mysql_config.path=/xxx/xxx(mysql安装路径/bin/mysql_config)