新网Logo
首页>主机-资讯>

CentOS下用pip安装mysql_python报错EnvironmentError: mysql_config not found 如何解决

登录 注册

CentOS下用pip安装mysql_python报错EnvironmentError: mysql_config not found 如何解决

  • 来源:网络
  • 更新日期:2020-05-14

摘要: 报错提示如下: Runningsetup.pyegg_infoforpackagemysql-python sh:mysql_config:commandnotfound Traceback(mostrecentcalllast): File"<string>",lin


报错提示如下:

Runningsetup.pyegg_infoforpackagemysql-python

sh:mysql_config:commandnotfound

Traceback(mostrecentcalllast):

File<string>,line16,in<module>

File/tmp/pip-build/mysql-python/setup.py,line18,in<module>

metadata,options=get_config()

Filesetup_posix.py,line43,inget_config

libs=mysql_config(libs_r)

Filesetup_posix.py,line25,inmysql_config

raiseEnvironmentError(%snotfound%(mysql_config.path,))

EnvironmentError:mysql_confignotfound

Completeoutputfromcommandpythonsetup.pyegg_info:

sh:mysql_config:commandnotfound

Traceback(mostrecentcalllast):

File<string>,line16,in<module>

File/tmp/pip-build/mysql-python/setup.py,line18,in<module>

metadata,options=get_config()

Filesetup_posix.py,line43,inget_config

libs=mysql_config(libs_r)

Filesetup_posix.py,line25,inmysql_config

raiseEnvironmentError(%snotfound%(mysql_config.path,))

EnvironmentError:mysql_confignotfound

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

Commandpythonsetup.pyegg_infofailedwitherrorcode1in/tmp/pip-build/mysql-python

Storingcompletelogin/root/.pip/pip.log


解决方法

安装mysql-devel后正常运行

yum installmysql-devel


如果手工安装mysql_python

在setup_posix.py内找到mysql_config.path

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