【发布时间】:2012-02-10 10:39:45
【问题描述】:
我在shell中使用这个命令来安装PIL:
easy_install PIL
然后我运行python 并输入:import PIL。但我得到这个错误:
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: No module named PIL
我从来没有遇到过这样的问题,你觉得呢?
【问题讨论】:
-
@RikPoggi This page of documentation 实际上告诉使用
from PIL import Image,这不起作用。 -
@Janne 只需使用 Import Image,PIL 就开始工作了。
-
此时我建议改为
easy_install Pillow。 Pillow 是 PIL 的一个分支,具有更好的封装并支持 Python 3。 -
您可以将接受的答案更改为推荐 Pillow 的答案吗?正如@LennartRegebro 所说,这个套餐更适合长期使用。
-
请改用
pip install Pillow。然后你可以做import PIL.Image
标签: python python-imaging-library easy-install