Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #9454

Re: should i install python image library by myself?

References <201107140818034940258@gmail.com>
Date 2011-07-13 18:04 -0700
Subject Re: should i install python image library by myself?
From Chris Rebert <clp2@rebertia.com>
Newsgroups comp.lang.python
Message-ID <mailman.1013.1310605495.1164.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, Jul 13, 2011 at 5:18 PM, think <thinke365@gmail.com> wrote:
> when i type import image in the python interactive command, i am surprised
> to find that it does not work. the details are as follows:

What led you to expect that exact command would work in the first place??

>>>> import image
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> ImportError: No module named image
>
> i wonder the image library should be a buildin module, then why i cannot
> import it?
> what's wrong? or some version of python does not include image library as a
> buildin module?

There is no standard library module by that name; no first-party
versions of Python include such a module. Thus, it's no surprise that
your import throws an exception.

> so can anybody recommend a version of python which include image libary,

I can only guess that your "image" library refers to either the
"Image" (capitalization matters!) *submodule* of PIL
(http://www.pythonware.com/products/pil/ ), or the "Image" class of
Tkinter (http://docs.python.org/library/tkinter.html#images ).

The former requires installation of PIL, and would then be correctly
imported via:
from PIL import Image

The latter is typically built as part of a default Python installation
and would be correctly imported via:
from Tkinter import Image # Python 2.x
or:
from tkinter import Image # Python 3.x

Cheers,
Chris
--
http://rebertia.com

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: should i install python image library by myself? Chris Rebert <clp2@rebertia.com> - 2011-07-13 18:04 -0700

csiph-web