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-pythonLooking in indexes: http://mirror...
·
问题:
运行程序提示: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
更多推荐
已为社区贡献3条内容
所有评论(0)