失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > python安装MySQLdb包遇到的坑:EnvironmentError: mysql_config not found

python安装MySQLdb包遇到的坑:EnvironmentError: mysql_config not found

时间:2020-08-16 13:56:50

相关推荐

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: /pypi/simpleCollecting MySQL-pythonDownloading /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_configlibs = mysql_config("libs_r")File "setup_posix.py", line 25, in mysql_configraise 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-pythonLooking in indexes: /pypi/simpleCollecting MySQL-pythonDownloading /pypi/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip (108kB)100% |████████████████████████████████| 112kB 890kB/s Installing collected packages: MySQL-pythonRunning setup.py install for MySQL-python ... doneSuccessfully installed MySQL-python-1.2.5

如果觉得《python安装MySQLdb包遇到的坑:EnvironmentError: mysql_config not found》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。