【教程】jupyter notebook使用最全教程

【教程】jupyter notebook使用最全教程


1. 安装

pip install jupyter

2. 使用

  • 在工程目录下执行命令,自动打开浏览器
jupyter notebook 
  • 浏览器不自动打开, 此时在浏览器地址栏手动输入 192.168.111.211(本机ip)或localhost或127.0.0.1:8888(端口号)
jupyter notebook --no-browser
  • 也可以指定需要监听的ip与端口号port
jupyter notebook --no-browser --ip=0.0.0.0 --port=8888
  • 关闭
两次ctrl + C

3. 配置远程访问+密码

  • 生成配置文件
jupyter notebook --generate-config
  • 打开ipython,创建密码
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password: (输入访问密码)
Verify password: (确认访问密码)
Out[2]: 'sha1:5abb4ceff757:755ad24707eedf644e07c34ec099d0485f9927a5'
复制密钥串,待会需要用到
  • 修改第一步生成的配置文件
vi ~/.jupyter/jupyter_notebook_config.py

在文件头部加入:

c.NotebookApp.ip='*' # 就是设置所有ip皆可访问
c.NotebookApp.password = u'刚才的密钥串'
c.NotebookApp.open_browser = False # 禁止自动打开浏览器
c.NotebookApp.port =8888 #指定一个端口
  • 启动,并输入密码登录
jupyter notebook

4. 虚拟环境+jupyter notebook

  • 进入虚拟环境
source virtualwork/bin/activate
  • 安装ipykernel
pip install ipykernel
  • 将虚拟环境加入到ipykernel
python -m ipykernel install --user --name=virtualwork
  • 启动jupyter notebook,就可以更改kernel了

5. 管理kernel

  • 查看已经安装的kernel
jupyter kernelspec list
  • 卸载指定kernel
jupyter kernelspec remove kernel名称

6. 卸载

pip uninstall jupyter-core jupyter-client qtconsole jupyter-console nbformat nbconvert notebook jupyter -y

7. 主要参考博客

[1] https://blog.csdn.net/Yuki_play/article/details/87646947
[2] https://zhuanlan.zhihu.com/p/27339792
[3] https://blog.csdn.net/weixin_40539892/article/details/80940885
[4] https://blog.csdn.net/fontthrone/article/details/84616937

  • 3
    点赞
  • 26
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值