龙空技术网

linux CentOS 安装python MySQLdb

flydragon 137

前言:

此刻朋友们对“python安装mysqldb”都比较重视,你们都需要学习一些“python安装mysqldb”的相关资讯。那么小编同时在网上网罗了一些对于“python安装mysqldb””的相关内容,希望大家能喜欢,兄弟们快快来学习一下吧!

1,运行sudo pip install MySQL-python遇到错误

错误信息如下:

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-Zszl8d/MySQL-python/

You are using pip version 9.0.1, however version 18.1 is available.

You should consider upgrading via the 'pip install --upgrade pip' command.

2,按照提示:sudo pip install --upgrade pip

3,sudo pip install MySQL-python 遇到新的错误

sh: mysql_config: command not found

Traceback (most recent call last):

File "<string>", line 1, in <module>

File "/tmp/pip-install-sUbQTV/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-install-sUbQTV/MySQL-python/

4,在网上搜索解决方案 sudo yum install mysql-devel

5, sudo pip install MySQL-python 安装成功

标签: #python安装mysqldb