解决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设计】。

相关文章

Python使用gensim计算文档相似性

pre_file.py #-*-coding:utf-8-*- import MySQLdb import MySQLdb as mdb import os,sys,string i...

解决Python 使用h5py加载文件,看不到keys()的问题

python 3.x 环境下,使用h5py加载HDF5文件,查看keys,如下: >>> import h5py >>> f = h5py.Fil...

Python中使用SAX解析xml实例

SAX是一种基于事件驱动的API。利用SAX解析XML文档牵涉到两个部分:解析器和事件处理器。解析器负责读取XML文档,并向事件处理器发送事件,如元素开始跟元素结束事件;而事件处理器则负...

Python自动连接ssh的方法

本文实例讲述了Python自动连接ssh的方法。分享给大家供大家参考。具体实现方法如下: #!/usr/bin/python #-*- coding:utf-8 -*- import...

Python使用psutil获取进程信息的例子

psutil是什么 psutil是一个能够获取系统信息(包括进程、CPU、内存、磁盘、网络等)的Python模块。主要用来做系统监控,性能分析,进程管理,像glances也是基于psut...