On Wed, Jul 13, 2011 at 5:18 PM, think <thinke...@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
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to