views:

175

answers:

2

This is a rather dumb question but i'am looking at a bizarre situation.

I am running fedora and have python 2.6.5 installed. The other day i installed MySQL-python using yum (because i do not have the setuptools module so i cannot build it from source).

Anyway yesterday i wrote my entire data access layer in python and it was running fine, i did test it.

Today however it gives me an ImportError: No module named MySQLdb

The only thing i ever changed was i installed eclipse and pyDev. Any ideas on what went wrong and how i fix it. I tried removing and re-installing MySql-python but that did not help.

I did the following

import sys
print sys.path

And it shows me all the paths which are basically pertaining to /usr/local/lib/python2.6

However i was trying to find where the MySQLdb module is installed and it seems that its installed in /usr/lib/python2.5/sitepackages

Now i have no idea why it got installed there and why it was working earlier and why it stopped working now. Any ideas on how i should fix it.

I did try copying the site-packages folder over to the python2.6 folder but that did not work

Help!!

+1  A: 

If all else fails, go to http://sourceforge.net/projects/mysql-python/ and install the package manually. This should work reliably.

BrainCore
true, but i hate how each module requires other modules and i'am having trouble getting setuptools installed. So i was hoping there was a way to just copy files in the right place.I'll keep at it though, it shouldn't be this hard!
MAC
So when i try to do manual install i get a runtime error. "Compression requires the (missing) zlib module.Now i have every zlib module installed. I even manually compiled and installed zlib!
MAC
Take a look at pip: http://pypi.python.org/pypi/pip -- it will handle a lot of requirements for you. On most systems you should be able to add pip with 'easy_install pip'. Which is the only time to use easy_install, IMO.
Tom
A: 

Well it seems to be working if i run or debug something from within eclipse. As it has the 2.5 version set as the python interpreter.

Does anyone know how i can set which python version to use in general on fedora. I'm sure i just have to set some path variable somewhere but not sure what!

MAC
Run 'which python' and then replace that with a symbolic link to 2.5's command.
Tom