问题
How do I add a local image to an IJulia notebook? The image is in the same local network folder as the IPYNB file. The folder is accessed via a symbolic link. I've tried both relative and absolute file names.
<img src="test.png" alt="Image Test" style="width:600px">

Both show up the same, as a broken image link with "Image Test" next to the symbol.
Jupyter Info:
Python 2.7.12 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:42:40)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]
notebook server is 4.2.3-da472a5
Julia Info:
Julia Version 0.5.0
Commit 3c9d753 (2016-09-19 18:14 UTC)
Platform Info:
System: Linux (x86_64-linux-gnu)
CPU: Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz
WORD_SIZE: 64
BLAS: libopenblas (NO_LAPACKE DYNAMIC_ARCH NO_AFFINITY Haswell)
LAPACK: liblapack.so.3
LIBM: libopenlibm
LLVM: libLLVM-3.7.1 (ORCJIT, haswell)
IJulia 1.3.2
回答1:

works fine for me; maybe it has to be in the same directory as the one where jupyter
is running, i.e. the directory shown in the top-level Jupyter dashboard?
(Without using FileIO
, you can also do display("image/png", read("file.png"))
.)
The ability to directly drag-and-drop or copy-paste images into notebook cells was recently added to Jupyter, so hopefully it will be in the next major release (Jupyter 4.3 or 5?).
回答2:
The answer was to move all the files to my hard drive. The folder I was using was on a local network. Even then only relative directories worked with both markdown methods.
Despite knowing what to do I don't yet know why. If somebody could suggest why this might be I would appreciate it.
回答3:
"(/notebooks/images/your_image.png)", this should work."notebooks" is just right after "localhost:xxxx/" in the search bar of your browser. Before this, I've tried both relative and absolute file names too, but failed. It seems Jupyter Notebook(in my case, ipython 6.3.1) does not support loading local images from any other place but the same one as the ipynb. Hope this would help.
来源:https://stackoverflow.com/questions/40527191/adding-a-local-image-to-an-ijulia-notebook