ModuleNotFoundError:没有名为“图像”的模块

时间:2019-09-12 10:23:17

标签: python-3.x linux ubuntu importerror

运行Python脚本时,收到以下消息:

ModuleNotFoundError: No module named 'Image'

我正在Linux Ubuntu上运行Python 3.6。 名为Fax_simulator的脚本包含:

import Image
# other code…

它位于:

/home/CVS/facsim/venv

我已经搜索了模块,并且找到了它:

/usr/lib/python3/dist-packages/PIL/Image.py

下面是几行代码:

import Image
import ImageDraw
import ImageFont

我必须安装它吗?如果是的话,怎么办?使用画中画?我从Python 3.6获得了PIP版本9.0.1。可以吗?

1 个答案:

答案 0 :(得分:3)

您需要从PIL包中导入它们:

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

# use Image

或者:

import PIL

# use PIL.Image