Jupyter

Posted yuzhen233

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Jupyter相关的知识,希望对你有一定的参考价值。

1 ) 魔法命令

1.1 ) 执行外部文件

%run add.py

3

add(2, 3)

5

1.2 ) 运行计时

%time print("hello word")
hello word
CPU times: user 68 μs, sys: 20 μs, total: 88 μs
Wall time: 93.9 μs
%timeit print("hello word")

1.3 ) 查看当前会话中的所有变量与函数

%who

Interactive namespace is empty.

%whos

Interactive namespace is empty.

%who-ls

No variables match your requested type.

1.4 ) 运行终端命令

!ls
add.py     test.ipynb

1.5 ) 查看魔法指令

lsmagic
Available line magics:
%alias  %alias_magic  %autocall  %automagic 
%autosave  %bookmark  %cat  %cd  %clear  %colors  %config  %connect_info  %cp  %debug  %dhist  %dirs  %doctest_mode  %ed  %edit  %env  %gui  %hist  %history  %killbgscripts  %ldir  %less  %lf  %lk  %ll  %load  %load_ext  %loadpy  %logoff  %logon  %logstart  %logstate  %logstop  %ls  %lsmagic  %lx  %macro  %magic  %man  %matplotlib  %mkdir  %more  %mv  %notebook  %page  %pastebin  %pdb  %pdef  %pdoc  %pfile  %pinfo  %pinfo2  %popd  %pprint  %precision  %profile  %prun  %psearch  %psource  %pushd  %pwd  %pycat  %pylab  %qtconsole  %quickref  %recall  %rehashx  %reload_ext  %rep  %rerun  %reset  %reset_selective  %rm  %rmdir  %run  %save  %sc  %set_env  %store  %sx  %system  %tb  %time  %timeit  %unalias  %unload_ext  %who  %who_ls  %whos  %xdel  %xmode
Available cell magics:
%%!  %%html  %%SVG  %%bash  %%capture  %%debug  %%file  %%html  %%javascript  %%js  %%latex  %%markdown  %%perl  %%prun  %%pypy  %%python  %%python2  %%python3  %%ruby  %%script  %%sh  %%svg  %%sx  %%system  %%time  %%timeit  %%writefile
Automagic is ON, % prefix IS NOT needed for line magics.

以上是关于Jupyter的主要内容,如果未能解决你的问题,请参考以下文章

python jupyter magic命令片段

开发工具 | 即将jupyter的新一代notebook

为啥jupyter notebook代码运行一直没有反应

为啥jupyter notebook代码运行一直没有反应

为啥jupyter notebook代码运行一直没有反应

为啥jupyter notebook代码运行一直没有反应?