欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

解决Ubuntu pip 安装 mysql-python包出错的问题

程序员文章站 2022-06-07 19:01:50
问题描述如下,报没有找到mysql_config环境变量 $ pip install mysql-python collecting mysql-pyth...

问题描述如下,报没有找到mysql_config环境变量

$ pip install mysql-python

collecting mysql-python==1.2.5 (from -r requirement (line 16))
 downloading mysql-python-1.2.5.zip (108kb)
100% |################################| 112kb 56kb/s 
complete output from command python setup.py egg_info:
sh: mysql_config: command not found
traceback (most recent call last):
 file "<string>", line 1, in <module>
 file "/tmp/pip-build-hveejz/mysql-python/setup.py", line 17, 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: mysql_config not found

----------------------------------------
command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-hveejz/mysql-python/

解决:

因为相关依赖没有安装

ubuntu/debian

sudo apt-get install libmysqlclient-dev

以上这篇解决ubuntu pip 安装 mysql-python包出错的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。