Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add PIL to PyDev in Eclipse, so i could import it and use it in my project?

I am trying to work with PIL in my project but the pydev can't seem to find it in my project. First of all I can see it when I enter the python shell, I can import it and I see it in the python sys.path. Second, I Added it to the PYTHONPATH in eclipse.

I restarted eclipse, but still, when I try to do "from PIL import Image" I am getting: "unresolved import".

Can any one please help me here, all other packages I used until now worked great the same way.... and i really need to use PIL

like image 872
Erez Avatar asked May 30 '11 02:05

Erez


People also ask

How do I import a Python module in Eclipse?

Click on the button, Install/Uninstall with pip. This will open the Manage pip window. The textbox Command to execute is where the pip commands are entered and then executed by clicking on the Run button. For example, to install the numpy package, type install numpy and click on Run.

How do I run a Python script in Eclipse IDE?

Running Python from within Eclipse py, and Eclipse will recognize it as Python code. Type in some Python code (for instance: print 2+2 ), then right-click on the Python file you've created and select Run As >> Python run . You should see the output of your Python code in the console at the bottom of the Eclipse window.


1 Answers

Try to go to Window -> Preferences -> Pydev-> Interpreter -> Python Interpreter -> Forced Builtins tab. Then add a PIL entry and apply. I've had the same unresolved import error when tried to import from this particular package (other packages worked fine), and found this information which finally helped me.

like image 110
Dzejkob Avatar answered Oct 04 '22 00:10

Dzejkob