Skip to content Skip to sidebar Skip to footer

Pydev Does Not Recognize Imports

I am using PyDev for Eclipse, and shows a few red underlines as erros for wrong imports. However, these imports work. I can start the script with F9, and use the Classes from these

Solution 1:

Assuming this code works elsewhere and the directory is in tact, you probably just have to rebuild which is pretty common with eclipse projects. To achieve this, navigate to the rebuild option under Project >> Clean.

EDIT: It is unlikely, but you may have to restart eclipse in order to make it work.

Solution 2:

The Python interpreter may not be set up correctly.

To correct this, go to Eclipse Preferences > PyDev > Interpreters > Python Interpreter, then select New to add the correct Python interpreter. Finally hit Apply and Close. You may have to re-open the editors.

In my case (macOS), the default was the Python 2 interpreter at /usr/bin/python, and I had to add the Python 3 interpreter from /usr/bin/python3.

Solution 3:

In my case, after certifying that the directory was added to the PATH, I did not need to restart the Eclipse, I just had to rewrite the from line, so that the IDE recognizes the directory with the intelisense. This is, if the red squiggles are still there.

  • NOTE: The libraries need to be added into External Libraires inside PyDev - PYTHONPATH

Post a Comment for "Pydev Does Not Recognize Imports"