为什么PIL的image.show()不能在google collab notebook上使用?

问题描述 投票:1回答:1

我正在使用PIL库来显示一个图像在google collab笔记本。但它是不工作的。谁能告诉我原因和显示图像的方法。我把我的代码放在下面。

from PIL import Image
Im=Image.open('image_name.png')
Im.show()
python image python-imaging-library jupyter show
1个回答
0
投票

这个问题出现在Jupyter Notebooks的情况下。使用show()不能显示图像。所以放弃像下面的代码那样调用show()。这将在单元格的输出中显示图像。

from PIL import Image
im = Image.open("lists.jpg")
im
© www.soinside.com 2019 - 2024. All rights reserved.