zoukankan      html  css  js  c++  java
  • centos搭建Jupyter Notebook

    想在哪个用户上用就一定要su user,然后再安装 ,不能-Hu user,不然报500错误

    1.pip3 install jupyter Notebook

    2.查看配置文件路径 jupyter notebook --generate-config

       指定项目文件夹 

    vim ~/.jupyter/jupyter_notebook_config.py   修改 c.NotebookApp.notebook_dir=

    3.[root@satp bin]# jupyter notebook --ip=0.0.0.0 --port 1985 --no-browser --allow-root  

    4.打开浏览器访问

    5.安装插件

    本机环境:
    centos7,python3.7,没有装Anaconda
    pip安装jupyter notebook插件

    pip install jupyter_nbextensions_configurator jupyter_contrib_nbextensions
    jupyter contrib nbextension install --user
    jupyter nbextensions_configurator enable --user

    安装了Anaconda的用户可以用conda安装

    conda install -c conda-forge jupyter_contrib_nbextensions
    conda install -c conda-forge jupyter_nbextensions_configurator

    启动 Jupyter Notebook,并导航至新的 Nbextensions 选项卡

    6.将Jupyter远程服务设置为守护进程

    使用systemd

      1.编写jupyter启动脚本,在/usr/sbin目录下新建jupyter.sh文件

    sudo vim /usr/sbin/jupyter.sh

    jupyter.sh中写入

    #!/bin/sh
    jupyter notebook --allow-root --ip=0.0.0.0

    此时创建的脚本文件还没有执行权限,所以执行下面这条命令

    sudo chmod +x /usr/sbin/jupyter.sh

     2.编写守护进程配置文件:守护进程的配置文件存放在/usr/lib/systemd/system/目录下,在该目录下新建jupyter.service文件

     

    sudo vim /etc/systemd/system/jupyter.service  // centos
    sudo vim /etc/systemd/system/jupyter.service .       // ubuntu

    打开jupyter.service文件并写入

    [Unit]
    Description = remote jupyter
    After = network.target
    
    [Service]
    Type=simple
    ExecStart=/usr/sbin/jupyter.sh
    
    [Install]
    WantedBy=multi-user.target
    1. 启动进程:v启动进程主要用到systemctl相关命令
    # 重新加载配置文件
    systemctl daemon-reload
    # 启动进程
    systemctl start jupyter.service

    相关命令:

    systemctl start ctlist    # 启动
    systemctl stop ctlist     # 停止
    systemctl restart ctlist  # 重启
    systemctl status ctlist   # 查看状态

    使用 nohup

    1. 创建启动文件

    vim /usr/sbin/jupyter.sh
    1. 写入启动命令

    nohup jupyter notebook --allow-root --ip=0.0.0.0 > deep.log &
    1. 运行启动文件

    ./jupyter.sh

    发现在jupyter中无法使用tab键来实现自动填充,也是查了许多,更改了诸多配置,但是还是没有失败了。每次调用tab键,报错
    在这里插入图片描述

    解决方法:尝试降低ipython版本

    pip install ipython==7.1.1    如果使用虚拟环境要进入环境再安装

    如果更改ipython版本后导致jupyter连接不上Kernel(无法运行代码,一直[*]):

    那就是python的版本兼容问题了,降低python的版本到3.6重新创建虚拟环境:

    virtualenv -p C:UsersAdministratorAppDataLocalProgramsPythonPython36python.exe  环境名称
  • 相关阅读:
    vue
    mongodb
    ejs模板引擎
    ajax
    node.js2
    node.js1
    bootstrap,ECMA
    商城
    面试:----Struts和springmvc的区别--区别上
    OpenStack
  • 原文地址:https://www.cnblogs.com/caicaizi/p/14416896.html
Copyright © 2011-2022 走看看