Categories
Programming python

Install MySQLdb for Python 2.x

If you want to install MySQLdb for Python 2.x, without using the package manager of your Linux distro (Ubuntu in our case), you can do it through pip like this:

First you must to have installed libmysqlclient-dev (and, of course pip)

[source language=”bash”]
sudo apt-get install libmysqlclient-dev
[/source]

After that execute this two commands:

[source language=”bash”]
sudo easy_install -U distribute
sudo pip install mysql-python
[/source]

Test if is working:
Type in the command line:

[source language=”bash”]
python
[/source]

and in the python console:

[source language=”python”]
>>> import MySQLdb
>>> help(MySQLdb)
[/source]

That’s all. Enjoy!

Leave a Reply

Your email address will not be published. Required fields are marked *