Why am I getting a `ModuleNotFoundError: No module named 'Image'` error?
Why am I getting a `ModuleNotFoundError: No module named 'Image'` error?
当我 运行 我的 Python 脚本时,我收到以下消息:
ModuleNotFoundError: No module named 'Image'
我 运行宁 Python 3.6 Linux Ubuntu。
名为 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。可以吗?
您需要从 PIL
包中导入它们:
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
# use Image
或者:
import PIL
# use PIL.Image
当我 运行 我的 Python 脚本时,我收到以下消息:
ModuleNotFoundError: No module named 'Image'
我 运行宁 Python 3.6 Linux Ubuntu。 名为 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。可以吗?
您需要从 PIL
包中导入它们:
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
# use Image
或者:
import PIL
# use PIL.Image