Question

I still cannot get PyDev and eclipse on MacOS to reliably import modules.

import csv generates an "Unresolved import:" error within PyDev; however, when I open Terminal and run the script from the interpreter it works fine.

PyDev is using the interpreter found at /usr/bin/python, which is pointing to Python 2.7.

The relevant files (csv.pyc and csv.pyo) are in /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7, which is in PYTHONPATH.

Was it helpful?

Solution

Actually, for the standard library, PyDev needs the .py files (from your description you only have the .pyc/.pyo files) -- it should give you a big warning when you try to configure an interpreter where the .py files are not available.

So, the recommended solution would be using a python distribution from http://python.org (instead of the default which comes with Mac OS) or grab the standard library from elsewhere and copy it over to where you have the standard library in Mac OS.

See the "IMPORTANT for Mac users" note at: http://pydev.org/manual_101_interpreter.html

OTHER TIPS

Everytime you add a new module, you need to reconfigure the interpreter in PyDEV. Whenever you do that, don't forget to check the new module you are adding to make sure it's being added to the PYTHON PATH.

Alternatively, you can configure each project by adding the new module to it. But that means you will have to configure this on a project basis. I would do it the other way.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top