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

yipeiwu_com5年前Python基础

问题描述如下,报没有找到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包出错的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持【听图阁-专注于Python设计】。

相关文章

解决win7操作系统Python3.7.1安装后启动提示缺少.dll文件问题

解决win7操作系统Python3.7.1安装后启动提示缺少.dll文件问题

错误提示图片 首先,我的操作系统是win7旗舰版,安装Python3.7.1之后启动时,提示如图错误,网上比较多的是两种处理方法: (1)安装Windows补丁程序 (2)安装...

在Python中操作字典之setdefault()方法的使用

 setdefault()方法类似于get()方法,但会设置字典[键]=默认情况下,如果键不是已经在字典中。 方法 以下是setdefault()方法的语法: dict.s...

Python SQLAlchemy基本操作和常用技巧(包含大量实例,非常好)

首先说下,由于最新的 0.8 版还是开发版本,因此我使用的是 0.79 版,API 也许会有些不同。因为我是搭配 MySQL InnoDB 使用,所以使用其他数据库的也不能完全照搬本文。...

python实现图片批量压缩程序

 本文实例为大家分享了python实现图片批量压缩程序的具体代码,供大家参考,具体内容如下 说明 运行环境:Win10 Pycharm 程序没有用到面向对象编程方法,...

使用python读取csv文件快速插入数据库的实例

如下所示: # -*- coding:utf-8 -*- # auth:ckf # date:20170703 import pandas as pd import cStringI...