Jupyter lab 和 VSCode 配置远程开发环境

Anaconda安装

  1. 下载 Anaconda 安装包,地址:Index of /anaconda/archive/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror 
  2. 安装 Anaconda,命令:bash Anaconda3-xxx.sh,然后全部选项默认。
  3. 修改用户目录下的 .condarc 文件更换清华镜像仓库,然后运行 conda clean -i 清除索引缓存。
    channels:
      - defaults
    show_channel_urls: true
    default_channels:
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
    custom_channels:
      conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

Jupyter lab 配置远程开发环境

  1. 安装 Jupyter lab,命令:conda install -c conda-forge jupyterlab
  2. 生成默认配置文件,命令:jupyter lab --general-config
  3. 设置秘钥,命令:jupyter server password
  4. 在生成的配置文件 ~/.jupyter/jupyter_server_config.py 中添加如下配置:
    c.ServerApp.allow_remote_access = True
    c.ServerApp.ip = '*'
    c.ServerApp.open_browser = False
    c.ServerApp.port = 8080
    c.ServerApp.root_dir = u'/'
  5. 启动 Jupyter lab,命令:jupyter-lab 或者 nohup jupyter-lab &
  6. 访问 http://Server-ip:8080。

Jupyter lab 配置使用 conda 的虚拟环境

  1. 激活想要使用的 conda 环境:conda activate env_name。如果使用 conda 时提示:CommandNotFoundError,先使用命令:source activate。
  2. 在该虚拟环境下安装 ipykernel:pip install ipykernel
  3. 在 jupyter 中添加环境:python -m ipykernel install --user --name env_name --display-name "name-want-to-display"

VS Code 配置远程开发环境

# 1. 下载 VS Code
# 2. 默认安装
# 3. 安装插件 Remote - SSH
# 4. 点击左下角启动 Remote 窗口,选则 Open SSH Configuration File...
# 5. 选择 ~/.ssh/config 并修改配置
Host example-name
    HostName 服务器地址
    User 用户名
# 6. 点击左下角启动 Remote 窗口,选则 Connect to Host...,选择 example-name
# 7. 安装服务器 Python 插件
# 8. 选择工作目录

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值