ImportError: No module named MySQLdb
[root@server pwd]# pip install MySQLdb
Collecting MySQLdb
Could not find a version that satisfies the requirement MySQLdb (from versions: )
No matching distribution found for MySQLdb
https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip

[root@server MySQL-python-1.2.5]# python setup.py install
sh: mysql_config: command not found
Traceback (most recent call last):
File “setup.py”, line 17, in
metadata, options = get_config()
File “/root/MySQL-python-1.2.5/setup_posix.py”, line 43, in get_config
libs = mysql_config(“libs_r”)
File “/root/MySQL-python-1.2.5/setup_posix.py”, line 25, in mysql_config
raise EnvironmentError(“%s not found” % (mysql_config.path,))
EnvironmentError: mysql_config not found

yum -y install mysql-devel

easy_install mysql-python (mix os)
pip install mysql-python (mix os)
apt-get install python-mysqldb (Linux Ubuntu)
cd/usr/ports/databases/py-MySQLdb && make install clean (FreeBSD)
yum install MySQL-python (linux Fedora, CentOS)
pip install mysqlclient (Windows)

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code