PIL and Windows Installations

greg Landrum greglandrum at earthlink.net
Sun Mar 12 16:31:48 EST 2000


Well, I've just gotten bit (again) by the "installing PIL under Windows"
problem.  I did a bit of Deja-News searching and discovered a couple
threads from late last year which provided all the answers I needed.

In the hopes of saving others from the frustration of trying to get PIL
(which is so great that it's a MUST HAVE) installed on Windows, I'm posting
my solution.  This is based upon the most recent binary PIL distribution:
http://www.pythonware.com/downloads/pil-win32-991101.zip
and *requires* that Tkinter is installed on your machine.  It comes by
default with the windows python distributions, so this shouldn't be too
much of a problem.  The binary distribution of PIL appears to require
Tcl/Tk anyway.

Step 1:
Unzip the archive (it doesn't matter where), this will create a directory
py152.
Copy the files/folders from py152 to your Python installation directory
(c:\program files\python by default).


That handles the installation.  Now try running one of the PIL sample
programs (I recommend Scripts/viewer.py).  If you get an error, then you'll
need to move to Step 2:
Edit the file c:\program files\python\pil\Image.py
Move down to around line 47, where you'll find:
    import _imaging
change this to:
    import sys
    if sys.platform == "win32":
	import FixTk # Attempt to configure Tcl/Tk without requiring PATH
    import _imaging
Save the file and try running Scripts/viewer.py again.  It ought to work.


I hope this is helpful.
-greg


-- 

greg Landrum (greglandrum at earthlink.net)
Software Carpenter/Computational Chemist



More information about the Python-list mailing list