Python MySQLdb package for Debian

I try to use MySQLdb module with my Python code for the first time. This is what I see:


import MySQLdb
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named MySQLdb
your code here

For Debian, the package for MySQLdb module is python-mysqldb.

# apt-get install python-mysqldb

Now, let’s verify if MySQLdb module has been correctly installed:

>>> import MySQLdb
>>>

No more import error message, which means you can start using MySQldb module now.

About these ads
Tagged , ,

One thought on “Python MySQLdb package for Debian

  1. PC Repair says:

    But if you’re on Windows XP, how would you get it running? We have a client that came in with his computer and also needed to get MySQL and Python working on the computer. Most of the solutions so far relate to UNIX/Linux and nothing for Windows users.

    Would be grateful if you could show how to get it running on Windows.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: