sorvad
Posts: 46
Joined: Thu Dec 22, 2011 11:04 am

Python Image Library (PIL)

Thu Jun 07, 2012 3:03 pm

Has anyone got this working on the PI yet ?

I've installed it using aptitude but when I run my script I get the error that

"ImportError : cannot import name ImageTk"

This is part of PIL, I've checked and the PIL folder is in the correct place:

/usr/lib/python2.5/site-packages/PIL/

but nothing seems to be happening, perhaps it's a path thing ? I'm new to Linux so not sure how to set that if I need to.

I've have had other errors for Tkinter etc. and successfully added those but this one just seems to refuse.

yeahbox
Posts: 36
Joined: Sun May 27, 2012 10:35 pm
Location: Manchester, UK

Re: Python Image Library (PIL)

Thu Jun 07, 2012 6:53 pm

sorvad wrote:This is part of PIL, I've checked and the PIL folder is in the correct place:
/usr/lib/python2.5/site-packages/PIL/
Are you using the debian image? If so, you probably want PIL for python 2.6. Try python -V to check which version you are using.

sorvad
Posts: 46
Joined: Thu Dec 22, 2011 11:04 am

Re: Python Image Library (PIL)

Thu Jun 07, 2012 7:43 pm

2.4,2.5 and 2.6 are in the Debain squeeze image. I did the check and it was using 2.6. So i copied the site-packages folder from 2.5 to 2.6 (as according to the PIL site the current version works for 2.5 and 2.6) but it made no difference. So still a bit puzzled. It does seem to be finding the image part of PIL but not imagetk, my line is

from PIL import image,imagetk

User avatar
croston
Posts: 673
Joined: Sat Nov 26, 2011 12:33 pm
Location: Blackpool
Contact: Website

Re: Python Image Library (PIL)

Thu Jun 07, 2012 10:15 pm

You might need to install the python module Tkinter. I'm sorry but I can't remember the Debian package name off the top of my head. It will be something like python-tk. Do a search with :

Code: Select all

$ sudo aptitude search python ¦ grep tk

sorvad
Posts: 46
Joined: Thu Dec 22, 2011 11:04 am

Re: Python Image Library (PIL)

Fri Jun 08, 2012 6:49 am

Already installed tkinter successfully as it it was one of items needed by my project. I know it was successful as it was originally moaning that it wasn't there until I installed it.

sorvad
Posts: 46
Joined: Thu Dec 22, 2011 11:04 am

Re: Python Image Library (PIL)

Sat Jun 09, 2012 10:45 pm

Right, I've sorted this, turns out there's a "python-imaging-tk" module that needs to be installed as well. In fact from a new install of Debian squeeze this appears to pull all the other required packages. I had to install xterm as well but then my project ran fine.

Return to “Python”

Who is online

Users browsing this forum: No registered users and 9 guests