• Ubuntu 搭建jupyter web server,Jupyter notebook远程访问


    Ubuntu 搭建jupyter web server,Jupyter notebook远程访问

    1. ubuntu20.04安装anaconda3

    2. 创建虚拟环境,安装jupyter notebook

    conda create -n jupter python=3.7
    Proceed ([y]/n)? 输入y,回车
    conda activate jupter
    
    conda install jupyter notebook
    Proceed ([y]/n)? 输入y,回车
    
    1. Jupyter notebook 配置
    1. 生成配置文件
    jupyter notebook --generate-config
    
    Writing default config to: /home/chengjialin/.jupyter/jupyter_notebook_config.py (配置文件所在路径)
    
    2. 创建密码
    使用python中的passwd()创建密码,终端输入ipython打开ipython并输入:
    
    In [1]: from notebook.auth import passwd
    In [2]: passwd()
    Enter password: ******
    Verify password: ******
    Out [2]: 'sha1:...'
    
    复制Out [2] 显示的密码('sha1:...' 包括引号)。
    
    1. 修改jupyter notebook的配置文件
    vim ~/.jupyter/jupyter_notebook_config.py
    
    在该文件中做如下修改或直接在文件尾端添加:
    
    c.NotebookApp.allow_remote_access = True #允许远程连接
    c.NotebookApp.ip='*' # 设置所有ip皆可访问
    c.NotebookApp.password = u'sha:..' #之前复制的密码
    c.NotebookApp.open_browser = False # 禁止自动打开浏览器
    c.NotebookApp.port =8888 #任意指定一个端口
    
    1. 设置notebook中文显示
    查看环境变量:
    (py38) ubuntu@VM-0-3-ubuntu:~$ env
    可以看到:LANGUAGE=en_US.utf8:
    
    查看是否安装有中文语言包:
    (py38) ubuntu@VM-0-3-ubuntu:~$ locale -a
    C
    C.UTF-8
    en_US.utf8
    POSIX
    没有就安装:
    (py38) ubuntu@VM-0-3-ubuntu:~$ sudo apt-get install language-pack-zh-hans
    Do you want to continue? [Y/n] 输入y,回车
    
    修改locale文件配置
    (py38) ubuntu@VM-0-3-ubuntu:~$sudo vim /etc/default/locale
    按i键,删除当前内容,再输入以下内容
    
    
    
    1. 启动jupyter notebook
    重启shell,再次激活jupter环境,运行jupyter notebook
    终端输入:
    jupyter notebook
    
    或使用nohup后台运行 jupyter notebook:
    nohup jupyter notebook >~/jupyter.log 2>&1 &
    
    1. 远程访问jupyter notebook
    本地浏览器输入http://(服务器地址):(配置文件中设定的端口); 假设服务器地址为192.168.1.129,配置的端口为8888,这里的浏览器输入地址应为http://192.168.1.129:8888; 即可访问jupyter notebook。
    
    
  • 相关阅读:
    ASP.NET MVC之从控制器传递数据到视图四种方式
    MVC发布到IIS,出现HTTP 错误 404.0
    超详细MySQL安装及基本使用教程
    node.js中使用node-xlsx插件生成excel数据并导出
    jquery给一组radio赋值和取值
    node.js生成excel下载各种方法分析对比--附excel-export方法
    JS中substr和substring的区别
    jq触发a标签的href跳转
    jq中跳出方法、for循环和each循环
    IIS应用程序池频繁崩溃的问题
  • 原文地址:https://www.cnblogs.com/michaelcjl/p/16474477.html
Copyright © 2020-2023  润新知