How to embed image or picture in jupyter notebook, either from a local machine or from a web resource?

后端 未结 15 1094
天命终不由人
天命终不由人 2020-11-30 16:12

I would like to include image in a jupyter notebook.

If I did the following, it works :

from IPython.display import Image
Image(\"img/picture.png\")
         


        
15条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-30 16:41

    You mustn't use quotation marks around the name of the image files in markdown!

    If you carefully read your error message, you will see the two %22 parts in the link. That is the html encoded quotation mark.

    You have to change the line

    ![title]("img/picture.png")
    

    to

    ![title](img/picture.png)

    UPDATE

    It is assumed, that you have the following file structure and that you run the jupyter notebook command in the directory where the file example.ipynb (<-- contains the markdown for the image) is stored:

    /
    +-- example.ipynb
    +-- img
        +-- picture.png
    

提交回复
热议问题