美文网首页
阿里ECS云端启动Jupyter Notebook失败之坑位处理

阿里ECS云端启动Jupyter Notebook失败之坑位处理

作者: MayerBin | 来源:发表于2019-03-08 14:28 被阅读0次

    更多内容请关注我的个人博客:

    本人是一个还没出道的小学生,抱着好奇,学人家搞了个阿里云的学生机,想不到一开始各种坑。。。。

    1.安装Anaconda

    下载网址:https://www.continuum.io/downloads#linux
    安装细节这里就不说太多

    image.png

    jupyter notebook

    • (1)简单介绍一下 jupyter notebook
    image.png

    (2)修改jupyter工作路径和服务路径

    jupyter notebook --generate-config  
    # 生成jupyter notebook配置文件
    
    ipython                         #打开ipython
    from notebook.auth import passwd
    passwd()                     #生成密码
    
    image.png
    • 修改配置文件
    vi ~/.jupyter/jupyter_notebook_config.py
    
    • 配置信息
    ## The IP address the notebook server will listen on.
    
    c.NotebookApp.ip = '云服务器的内网ip'
    c.NotebookApp.password = u'sha1:69e1c474494c:7f9b4e774f7b5按(2)生成的'
    c.NotebookApp.open_browser = False
    c.NotebookApp.port =8888
    c.NotebookApp.notebook_dir = '/home/hadoop/jupyter' 
    
    
    image.png image.png

    (3) 启动自动补全

    ipython profile create   # 生成配置文件
    
    vi /home/hadoop/.ipython/profile_default/ipython_config.py
    
    
    
    image.png
    • 启动 jupyter notebook
    image.png
    • 使用公网IP登录


      image.png

    启动失败看这里:

    1. 工作路径没有生成,/home/hadoop/jupyter,可以自己到对应的目录,直接mkdir jupyter

    2.ip地址写错,请注意一定要是阿里云的内网ip,登录的时候要用公网ip登录

    image.png
    1. 显示dial tcp ...:8888: i/o timeout
      解决方法:需要在网络与安全下的安全组里添加一个允许8888端口的tcp协议的安全组规则。
    image.png

    jupyter lab后台常驻

    # 用notebook的改成notebook
    nohup jupyter lab --config=jupyter_config.py &
    
    nohup jupyter notebook --allow-root --config=root_jupyter_config.py & 
    
    # 文件重定向
    nohup command > myout.file 2>&1 &
    
    # 启动
    nohup jupyter lab>~/jupyter.log 2>&1 &
    

    停止进程

    # 查看进程 (ps   a)
    ps -ef | grep 'jupyter notebook'
    # 输出内容类似:
    # root      9120  9100  0 00:01 pts/1    00:00:00 grep --color=auto jupyter notebook
    # 杀死进程
    kill -9 9100
    # 此时浏览器中无法访问
    

    参考链接:
    https://www.zhangshuang.top/?p=189

    https://blog.csdn.net/sinat_28442665/article/details/85612475

    https://zhuanlan.zhihu.com/p/83884252

    相关文章

      网友评论

          本文标题:阿里ECS云端启动Jupyter Notebook失败之坑位处理

          本文链接:https://www.haomeiwen.com/subject/ohjrpqtx.html