Jupyter Notebook 的相关备忘。
命令
pip
1 2 3 4 5 6 7 8
| ! %
!pip install xx -t ~/your/path import sys sys.path.append("~/your/path")
|
magic
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| %lsmagic
%env OMP_NUM_THREADS=4
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
%run your_python.py
%%writefile path_to_py_file.py
%pycat path_to_py_file.py
%pdb
%load_ext scalene
|
更多:Built-in magic commands — IPython 7.24.1 documentation
display
1 2 3
| from IPython.core.interactiveshell import InteractiveShell InteractiveShell.ast_node_interactivity = "all"
|
安装启动
插件
1 2 3 4
| pip install jupyter_contrib_nbextensions
|
远程服务器本地访问
1 2
| ssh remote_name@remote_address -L 127.0.0.1:remode_port:127.0.0.1:local_port
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
jupyter notebook --generate-config
ipython from notebook.auth import passwd passwd()
vim ~/.jupyter/jupyter_notebook_config.py
c.NotebookApp.allow_remote_access=True c.NotebookApp.ip='*' c.NotebookApp.open_browser=False c.NotebookApp.password="sha1:3......." c.NotebookApp.port=9999
jupyter notebook jupyter notebook --config /path/to/jupyter_notebook_config_backup.py
http://remote_address:9999/
|
后台运行
1
| nohup jupyter notebook > jupyter.log 2>&1 &
|
旧版本
实在受不了7.0以上版本。删除所有已有的安装包重新安装旧版本。
1 2 3 4 5 6 7 8
| $ pip uninstall jupyter notebook jupyter_contrib_nbextensions ... $ rm -rf /usr/local/lib/python3.9/site-packages/jupyter* $ rm -rf ~/.jupyter $ rm /usr/local/bin/jupyter*
$ pip install notebook==6.0.0 $ pip install jupyter $ pip install jupyter_contrib_nbextensions==0.7.0
|
然后就可以畅游旧版本了,错误全部忽略不管。