37,743
社区成员
发帖
与我相关
我的任务
分享
from IPython.display import display, Image
path = "1.jpg"
img = Image(path)
display(img)

同样显示<IPython.core.display.Image object>[/quote]
忘了问了,你是在jupyter notebook里运行的吗?[/quote]
不是,是在pycharm里,刚才弄了一下jupyter,这里面显示没问题,但是pycharm不行,如何能在pycharm弄成呢?[/quote]
你可以这么写
import matplotlib.pyplot as plt
img = plt.imread(r'C:\Users\secsi\Pictures\Saved Pictures\384px-Venn0111.svg.png')
plt.imshow(img)
plt.show()[/quote]
嗯嗯,谢谢,用这个写我知道,不过我是想知道用Ipython.display中的实现,谢谢
同样显示<IPython.core.display.Image object>[/quote]
忘了问了,你是在jupyter notebook里运行的吗?[/quote]
不是,是在pycharm里,刚才弄了一下jupyter,这里面显示没问题,但是pycharm不行,如何能在pycharm弄成呢?[/quote]
你可以这么写
import matplotlib.pyplot as plt
img = plt.imread(r'C:\Users\secsi\Pictures\Saved Pictures\384px-Venn0111.svg.png')
plt.imshow(img)
plt.show()
同样显示<IPython.core.display.Image object>[/quote]
忘了问了,你是在jupyter notebook里运行的吗?[/quote]
不是,是在pycharm里,刚才弄了一下jupyter,这里面显示没问题,但是pycharm不行,如何能在pycharm弄成呢?
同样显示<IPython.core.display.Image object>[/quote]
忘了问了,你是在jupyter notebook里运行的吗?
同样显示<IPython.core.display.Image object>