PIL과 함께 작업 할 때 많은 PIL 모듈을 가져와야합니다. 나는이 작업을 수행하는 세 가지 방법으로 실험을했지만, 마지막 하나의 작품 모두가 나에게 논리적되고있는에도 불구하고 : 전체 PIL을 가져 오기파이썬 PIL 가져 오기가 작동하지 않는 이유는 무엇입니까?
를하고 코드에서 모듈의 호출 : 아니
>>> import PIL
>>> image = PIL.Image.new('1', (100,100), 0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'Image'
모든 것을 가져 오기
>>> from PIL import *
>>> image = Image.new('1', (100,100), 0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'Image' is not defined
PIL에서 일부 모듈을 가져 NOPE :
>>> from PIL import Image
>>> image = Image.new('1', (100,100), 0)
>>> image
<PIL.Image.Image image mode=1 size=100x100 at 0xB6C10F30>
>>> # works...
OK PIL에서
나는 여기에 무엇을하지 않았는가?