Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing mysql-python on Centos

Tags:

People also ask

How do I install MySQL on Python 3?

The easiest way to probably install and use MySQL in Python is to open up your command prompt. Once the command prompt is opened, then specify the full path to the Scripts folder of the Python package. Once you have this full path specified to the Scripts folder, then type in, pip install pymysql.

Is MySQL compatible with Python?

MySQL server and Python versions within parentheses are known to work with Connector/Python, but are not officially supported. Bugs might not get fixed for those versions. Connector/Python does not support the old MySQL Server authentication methods, which means that MySQL versions prior to 4.1 will not work.


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 "<stdin>", 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?