Skip to content Skip to sidebar Skip to footer

No Module Named Image Tk

I am new to python can any body please Help D:\python\sub>python app.py Traceback (most recent call last): File 'app.py', line 2, in import ImageTk ImportEr

Solution 1:

This says that python is installed in non-standard location so the OS can not find ImageTk as it look in standard locations. You can re-install Python in a standard location, and where that is depends on which operating system and which installer you are using, or append this location to sys.path. I'm using Ubuntu 13.04 and I simply install ImageTk package by using terminal like:

sudo apt-get install python-imaging-tk

Solution 2:

I had to import the PIL.ImageTk module separately. The line of code

import PIL

did not import the PIL.ImageTk module and I had to additionally use

fromPILimportImageTk

and then it worked fine in the Enthought Canopy 1.0 distribution of Python 2.7.

The need for that solution was suggested by this redhat bug resolution:https://bugzilla.redhat.com/show_bug.cgi?id=247171

This could also be accomplished with import PIL.ImageTk.

Solution 3:

The code that you are using should be installed separately from the normal python installation, in fact comes from PIL libray (Python Imaging Library) which is an external library, an add on.

Beware that the PIL library doesn't work on python version 3.0 and over, but is still working only on python 2.x series, so if you have python 3.x installed you should first install a python 2.x and than download and install the corresponding PIL Library.

Here a link to PIL library, you can download from here.

Solution 4:

You need to make sure that the ImageTK module has been installed. It is part of the Python Imaging Library (PIL) which can be found here

I would also suggest you read the official Python tutorial on Modules.

Solution 5:

For windows (with Anaconda and Python 3.x), the solution is proposed here : Pillow installation for python 3.x [and Anaconda]

Install Pillow with pip after downloading the whl file

Post a Comment for "No Module Named Image Tk"