jupyter安装和使用小结

1.Jupyter introduction

The Jupyter Notebook is a web-based interactive computing platform. The notebook combines live code, equations, narrative text, visualizations
Refence to: https://jupyter.org/

2. linux下安装

2.1 使用conda安装较为方便

conda install jupyter notebook

2.2 使用pip安装

pip3 install jupyter

3. Jupyter 配置

3.1 基础文件配置

jupyter notebook --generate-config    // produce  configfiles calling ***"jupyter_notebook_config.py"*** under hidden directorary .jupyter which locates home.

Get password:

from notebook.auth import passwd
passwd()

or you can set as the following method:

jupyter notebook password

This command will produce a json configuration file under .jupyter, called jupyter_notebook_config.json . Parameters can be changed if possible.It’s better to reference to https://jupyter-notebook.readthedocs.io/en/stable/config.html

c.NotebookApp.ip=‘*’ // 任意IP可以访问 c.NotebookApp.password =u’sha1:ce…复制的那个密码串’ //passwd() 生成的密码
c.NotebookApp.open_browser = False
c.NotebookApp.port =8888 #可以自行指定服务器未使用的端口 c.NotebookApp.allow_remote_access = True
c.NotebookApp.notebook_dir = ‘/public/group/user/.jupyter/’ // work directory of jupyter and code files will be saved at the directory.

3.2 主题配置

pip install jupyterthemes
jt -l                     // list theme
jt -t chesterish   // setup theme

Note: After installing, reboot Jupyter.

4. 远程访问

启动: nohup jupyter notebook >~/jupyter.log 2>&1 & or /usr/local/bin/jupyter-notebook --allow-root --port=8890 --ip 192.xxx // Need root authority
http://ip:8888 # //浏览器中输入 设置的ip和端口即可访问

5. jupyterhub中灵活使用不同版本的python、R或者其他语言

Used conda to install python or R plantform stepwisely, for example installing pyhthon 3.9:

conda create -n python3.9 python=3.9    // create virtual environment 
conda activate python3.9                        // activate environment
python3 -m pip install ipykernel             // install ipykernel. note: Other packages should be installed as this way.
python -m ipykernel install --name py39 --user   // register into jupyterhub, name will by shew in brower.

Another example installing R:

conda create -n R4
conda create -n R4
conda install python=3.6  // install python again, provide port?
python3 -m pip install ipykernel
conda install -c conda-forge r-base=4.2.0
R
options("repos" = c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/"))
install.packages('IRkernel')
IRkernel::installspec(name = 'ir4.0test', displayname = 'R4.2')

6. jupyterhub使用

Interface was divided different cells. Impement codes in cell using ctr+ enter
在这里插入图片描述

reference: https://www.tutorialspoint.com/jupyter/jupyter_notebook_types_of_cells.htm

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

xuantianyixiao

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值