• docker for windows--安装jupyter运行环境


    1. 安装anaconda3镜像

    下载地址:anaconda3:2022.05

    安装命令:

    docker pull continuumio/anaconda3:2022.05
    
    docker run -i -t continuumio/anaconda3 /bin/bash
    
    • 1
    • 2
    • 3

    2. 配置jupyter

    1. 启动docker镜像 docker run -it --name=jupyter-server -p 8888:8888 -v D:/jupyter:/root/jupyter:rw continuumio/anaconda3:2022.05 /bin/bash
    2. 生成jupyter配置文件 jupyter notebook --generate-config
    3. 生成jupyter密码
      有如下2种方式:
      • jupyter notebook password,输入密码后,打开jupyter_notebook_config.json文件即可查看生成的密码
      • 代码生成,ipython进入交互式命令行,输入:from notebook.auth import passwd; passwd()
    4. 在D:/jupyter下放置修改好的配置文件,即在生成的配置文件jupyter_notebook_config.py上加如下信息:
    c.NotebookApp.ip = '*'
    c.NotebookApp.open_browser = False
    c.NotebookApp.password = u'argon2:$argon2id$v=19$m=10240,t=10,p=8$vadvh23sfsdf23w$h36RvyptgXfn//yO523234Dh32x0Q'
    c.NotebookApp.port = 8888
    c.NotebookApp.iopub_data_rate_limit=1.0e10
    c.NotebookApp.allow_remote_access = False
    c.NotebookApp.notebook_dir = '/root/jupyter/notebooks'
    c.NotebookApp.allow_root = True
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    1. 安装pyecharts pip install pyecharts
    2. 安装jupyter_contrib_nbextensions
    pip install jupyter_contrib_nbextensions
    jupyter contrib nbextension install --user
    
    #注意: 开启,需要先安装
    pip install autopep8
    #拆分单元格
    pip install qgrid
    jupyter nbextension enable --py --sys-prefix qgrid
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    1. 安装一些工具
    pip install pandas_profiling
    pip install --pre scapy[complete]
    pip install qrcode[pil]
    pip install pandasql3
    
    • 1
    • 2
    • 3
    • 4
    1. 启动jupyter jupyter notebook --config=/root/jupyter/jupyter_notebook_config.py

    2. 配置jupyter_contrib_nbextensions,打开http://localhost:8888/nbextensions,配置如下:
      在这里插入图片描述

    3. 在D:/jupyter放启动脚本start.sh,脚本如下:

    nohup jupyter notebook --config=/root/jupyter/jupyter_notebook_config.py > /root/jupyter/notebook.log 2>&1 &
    
    • 1

    3. 保存镜像

    将步骤2的修改进行保存

    docker commit -a="java编程艺术" -m "jupyter config" 7b5f46e2ad5b jupyter:2022.5
    
    • 1

    4. 启动jupyter镜像

    #运行方式1
    docker run -d --name=jupyter-server -p 8888:8888 -v D:/jupyter:/root/jupyter:rw jupyter:2022.5
    docker exec -it cffb8dc6acd0 /bin/bash
    
    #运行方式2
     docker run -it --name=jupyter-server -p 8888:8888 -v D:/jupyter:/root/jupyter:rw -v D:/pyecharts-assets:/opt/conda/lib/python3.9/site-packages/notebook/static/components/pyecharts/assets:rw jupyter:2022.5 /bin/bash
    
    #启动jupyter
    /root/jupyter/start.sh
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    5. 浏览器编辑notebook

    1. 打开浏览器 http://localhost:8888/login, 使用设置的密码登录
    2. 使用jupyter,开启工作吧
      • 具备左边的导航栏
      • 编写代码有提示功能
      • 可以拆分单元格
        ![在这里插入图片描述](https://img-blog.csdnimg.cn/cc0c274c283141a9ba025469ed27d96d.png
  • 相关阅读:
    使用反射调用私有内部类方法
    学习笔记-VSFTP
    制作一个简单HTML个人网页网页(HTML+CSS)大话西游之大圣娶亲电影网页设计
    系列学习 SpringCloud-Alibaba 框架之第 4 篇 —— Sentinel 高可用流量控制组件
    Lamt的部署
    leetcode 118.杨辉三角形
    冰冰学习笔记:快速排序
    if和, && ||
    【LeetCode算法系列题解】第76~80题
    windows下软件推荐
  • 原文地址:https://blog.csdn.net/penriver/article/details/127697646