I'm trying to get the MySQL-python lib installed on centos 5.5. I ran
sudo yum install MySQL-python
but then when I tried:
import MySQLdb
I get this error:
Traceback (most recent call last):
File "", line 1, in ?
File "MySQLdb/__init__.py", line 22, in ?
raise ImportError("this is MySQLdb version %s, but _mysql is version %r" %
ImportError: this is MySQLdb version (1, 2, 3, 'final', 0), \ # added linebreak
but _mysql is version (1, 2, 1, 'final', 1)
any clues on how to fix this?
解决方案
You probably did not install MySQL via yum? The version of MySQLDB in the repository is tied to the version of MySQL in the repository. The versions need to match.
Your choices are:
Install the RPM version of MySQL.
Compile MySQLDB to your version of
MySQL.