Notes on Installing PIL with Cygwin

In a word: You can't, so don't waste a bunch of time trying like I did.

Well, as a relative newbie I shouldn't definitively state that it can't be done, but such is my assessment based on a morning of internet research and trial and error.

As much as I would prefer being able to use a single Python interpreter on my machine, in the end the easiest way to get the Python Imaging Library (PIL) installed was to download the standalone Python 2.2 installer for windows from http://python.org/download/. This will create a separate installation of the Python interpreter from the one used by Cygwin that should enable you to install PIL without a hitch.

By default, the installer will put Python in C:Python22. Assuming you've already downloaded and run the PIL Windows installer for Python 2.2 from http://www.pythonware.com/products/pil/, all you need to do is move the file PIL.pth and the whole directory PIL from C:py22 to C:Python22Libsite-packages, and copy the files _imaging.pyd and _imagingtk.pyd from C:py22DLLs to C:Python22DLLs

With that done, you should be able to run the demo scripts in C:py22Samples with no trouble - just make sure you specify the correct Python interpreter! If you want to run PIL scripts from a Cygwin shell, you'll need to specify the full path to your other Python interpreter:

$/cygdrive/c/python22/python viewer.py /path/to/some/file.jpg

Thankfully, you can use ln to create a symbolic link in your Cygwin path so you're not forced to type that full path:

$ln -s C:/python22/python /usr/bin/python22

Now, in Cygwin, you can run python to use the Cygwin Python interpreter, or python22 to use the PIL-enabled Python interpreter.

Postscript: According to the post at http://sources.redhat.com/ml/cygwin/2002-05/msg00582.html it is possible to compile PIL from source under Cygwin, but it takes some doing.

Syndicate content

Twitter

Older

Contact

Andy Chase
(978) 297-6402
andychase [at] gmail.com
GPG/PGP Public Key