How can I display an image from a file in Jupyter Notebook?

前端 未结 11 1180
被撕碎了的回忆
被撕碎了的回忆 2020-11-28 01:03

I would like to use an IPython notebook as a way to interactively analyze some genome charts I am making with Biopython\'s GenomeDiagram module. While there is extensive doc

11条回答
  •  日久生厌
    2020-11-28 01:35

    This will import and display a .jpg image in Jupyter (tested with Python 2.7 in Anaconda environment)

    from IPython.display import display
    from PIL import Image
    
    
    path="/path/to/image.jpg"
    display(Image.open(path))
    

    You may need to install PIL

    in Anaconda this is done by typing

    conda install pillow
    

提交回复
热议问题