ImportError:Python 3.4中没有名为'PIL'的模块

0 投票
1 回答
9175 浏览
提问于 2025-04-18 03:22

我在文件的开头有这样的代码:

from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw

然后它报了一个错误:

python3 main.pyTraceback (most recent call last):
  File "main.py", line 1, in <module>
    from PIL import Image
ImportError: No module named 'PIL'

根据很多建议,我应该把 import PIL 替换成我实际使用的东西。但是你可以看到,这样做并没有效果。

我使用的是Ubuntu 14.04和Python 3.4.0

1 个回答

1

根据这个链接,你应该可以用import Image来代替import PIL

撰写回答