zoukankan      html  css  js  c++  java
  • 在windows上远程访问服务器jupyter notebook

    更新2020.11.13

    最近在实验室租的GPU上使用jupyter notebook,需要在后面挂上本机IP,以及另外一个命令:

    jupyter notebook --no-browser --port=1111 --ip=xx.xx.xx.xx --allow-root

    需求:

    之前在服务器上只能运行完整的python文件,而不能实现jupyter notebook的交互模式,通过在本地浏览器上远程访问服务器上的jupyter notebook,这样不就能有一个很棒的交互环境了吗。

    实现

    1、首先需要在服务器上安装jupyter notebook

    pip install jupyter notebook

    2、在服务器上

    jupyter notebook --no-browser --port=1111

    端口号选择1024-49151中任一,避免与其他服务端口冲突,然后出现

    token=后面的东西要用到

    3、在本地上打开bash,

    ssh -N -f -L localhost:1112:localhost:1111 username@serverIP

    输入服务器密码。

    4、在本地浏览器上打开

    http://localhost:1112

    提示需要输入token,把上面的token输入。

    5、进入交互环境,但此时的kernel环境是服务器的全局环境,我需要进入服务器的虚拟环境,

    网上说需要安装ipykernel和nb_conda(但我的服务器装不了),于是只pip install ipykernel;

    然后将环境添加到ipython的kernel中,

    python -m ipykernel install --user --name 虚拟环境名称 --display-name 虚拟环境名称

    在ipynb中选择Kernel即可

    注意的是:第二次在本地访问服务器的jupyter notebook时,只需要在服务器上执行步骤2,然后在本地浏览器打开4的地址即可,不用在bash上连接了

    参考https://blog.csdn.net/qq_32612467/article/details/78728883

  • 相关阅读:
    11.26
    数组
    JavaScript
    2018.11.26
    input标签
    HPH 函数
    jQuery
    19/1/3数组
    2018/12/26//循环体
    12/25
  • 原文地址:https://www.cnblogs.com/yqpy/p/11388521.html
Copyright © 2011-2022 走看看