我是靠谱客的博主 迷人萝莉,最近开发中收集的这篇文章主要介绍python安装MySQLdb包遇到的坑:EnvironmentError: mysql_config not found,觉得挺不错的,现在分享给大家,希望可以做个参考。
概述
问题:
运行程序提示:ImportError: No module named MySQLdb
解决步骤:
1、安装MySQL-python包,提示错误:EnvironmentError: mysql_config not found
[root@VM static]# pip2 install MySQL-python
Looking in indexes: http://mirrors.tencentyun.com/pypi/simple
Collecting MySQL-python
Downloading http://mirrors.tencentyun.com/pypi/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip (108kB)
100% |████████████████████████████████| 112kB 822kB/s
Complete output from command python setup.py egg_info:
sh: mysql_config: 未找到命令
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-p9LTrB/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
2、MySQL-python包依赖mysql-devel包,需首先安装mysql-devel包
yum -y install mysql-devel
3、安装完成mysql-devel包,再次安装MySQL-python包成功
[root@VM static]# pip2 install MySQL-python
Looking in indexes: http://mirrors.tencentyun.com/pypi/simple
Collecting MySQL-python
Downloading http://mirrors.tencentyun.com/pypi/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip (108kB)
100% |████████████████████████████████| 112kB 890kB/s
Installing collected packages: MySQL-python
Running setup.py install for MySQL-python ... done
Successfully installed MySQL-python-1.2.5
最后
以上就是迷人萝莉为你收集整理的python安装MySQLdb包遇到的坑:EnvironmentError: mysql_config not found的全部内容,希望文章能够帮你解决python安装MySQLdb包遇到的坑:EnvironmentError: mysql_config not found所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复