1

I use LiClipse as my Python IDE. I imported two given skeletons in order to extend them (my first Python project). I created a PyDev project and dragged and dropped the files beneath the root of the project. The .py file declares the following import statements:

import cv2
import numpy as np
import math

Every use of cv2 or np results in an Undefined variable from input. Is this question identical to How do I fix PyDev "Undefined variable from import" errors? (with a proposed solution of just ignoring the error in the IDE) or did I forget some settings?

enter image description here enter image description here

Community
  • 1
  • 1
Matthias
  • 4,481
  • 12
  • 45
  • 84

1 Answers1

2

As those modules are built-in, it seems that you have not defined the Python interpreter for your IDE and/or the project's properties.

Set your Python installation in Project -> Properties -> Interpreter/Grammar

In case you want to use external modules, you can add them to the project by defining the PYTHONPATH in Project -> Properties -> PYTHONPATH.

Matthias
  • 4,481
  • 12
  • 45
  • 84
juankysmith
  • 11,839
  • 5
  • 37
  • 62
  • Grammar Version: 2.7/Interpreter: Default -> Grammar Version: 3.0/Interpreter: Python (I guess?); the PYTHONPATH was indeed empty – Matthias Mar 04 '14 at 08:30
  • Under "Interpreter" combobox you will find a link that says "Click here to configure an interpreter not listed" where you can select the path to your python installation. – juankysmith Mar 04 '14 at 08:36
  • Path already seems already to be correct (ref. Preferences). And contains all the builtins beneath Forced Builtins? – Matthias Mar 04 '14 at 08:48
  • Sorry, I don't understand what you say, anyway, you will find the installed modules in /lib/site-packages/ folder – juankysmith Mar 04 '14 at 09:02
  • I see (both in the Preferences/Python Interpreters & PyDev Package Explorer view) that the cv2.pyd is part of the System Libs, numpy.pyd is part of the Forced Builtins which both belong to my Pyhon33. But what I need to do with them? – Matthias Mar 04 '14 at 09:16