When I write import MySQLdb
in Eclipse using the PyDev plugin, I get an unresolved import. However, the program runs without error. I can add an annotation to get
It sounds like MySQLdb
is somewhere on your sys.path
, but not on your Eclipse project's PYTHONPATH
; in other words, Eclipse thinks you're going to get an import error at runtime because you haven't fully configured it. Google seems to say that you can alter this setting in Window->Preferences->Preferences->PyDev->Python Interpreter
to include the path to your MySQLdb
module.
For some help figuring out where MySQLdb
might be living on your system:
import MySQLdb
print MySQLdb.__file__
; it may be the __init__
file in the package that you need to point the path at.cdleary above provided the reason two years ago, but this may be easier. Basically, one reinstalls the interpreter.
This works on Fedora 17 using the Eclipse 4.2.0 that came with the package management.