运行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。可以吗?
答案 0 :(得分:3)
您需要从PIL
包中导入它们:
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
# use Image
或者:
import PIL
# use PIL.Image