Search code examples
pythoneclipseimportpython-imaging-librarypydev

The PIL library import fails


Being a complete begginer in python, I decided to install the python interpreter 3.4.4, and also PyDev plugin for eclipse IDE. I am also using windows 10.

I have encountered a problem regarding certain imports, namely : from PIL import Image, ImageTk, which is apparently an unresolved import.

I have looked at certain questions which were similar to my situation, but most of them gave a solution like installing packaged from the linux apt-get. Here are some topics I visited :

  1. Uninstalling and reinstalling Pillow and pip,
  2. Installing pillow-imaging-tk on Ubuntu,
  3. This topic which left me very confused,
  4. This one seemed helpful, but is on Unix OS again

So please, could someone explain to me why I am seeing this error, and how could I correct it if I absolutely want to use Eclipse, Pydev, windows 10 and Python 3.


Solution

  • Found the solution, here's what I did:

    1. Set the PYTHONPATH like it is shown in this article, make sure python.exe is accessible via cmd,
    2. Via cmd, type pip install pillow. Alternatively, you can enter the same command from Windows+R,
    3. (Not sure if relevant step) Via eclipse, Windows->Preferences->PyDev->PythonInterpreterremove your interpreter to re-add it,
    4. Restart eclipse.