0

I installed MySQLdb module for python2.7 using

pip install mysql-python

But when I try to access I get the error below. Would appreciate if you can help solve the issue

root# python Python 2.7.14 (default, Oct 17 2017, 19:22:55) [GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import MySQLdb Traceback (most recent call last): File "", line 1, in File "/home/y/lib/python2.7/site-packages/MySQLdb/init.py", line 19, in import _mysql ImportError: libperconaserverclient.so.18: cannot open shared object file: No such file or directory

1 Answer 1

0

On Ubuntu it is advised to use the distributions repository. Try installing with the following command:

sudo apt-get install python-mysqldb

To get all the prerequisites for python-mysqldb to install it using pip, run this:

sudo apt-get install build-essential python-dev libmysqlclient-dev
Sign up to request clarification or add additional context in comments.

1 Comment

I am on redhat. apt-get does not work > root# sudo apt-get install python-mysqldb sudo: apt-get: command not found

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.