Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No module named Image tk [closed]

Tags:

python

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 <module>     import ImageTk ImportError: No module named ImageTk 
like image 547
Rakesh12 Avatar asked May 17 '12 06:05

Rakesh12


2 Answers

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 
like image 123
Zeb Avatar answered Oct 07 '22 16:10

Zeb


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

      from PIL import ImageTk 

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.

like image 45
Bennett Brown Avatar answered Oct 07 '22 17:10

Bennett Brown