欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 科技 > 能源 > 远程深度学习新环境配置流程

远程深度学习新环境配置流程

2025/5/5 13:20:59 来源:https://blog.csdn.net/weixin_45668967/article/details/147627446  浏览:    关键词:远程深度学习新环境配置流程

✅ 远程深度学习新环境配置流程

文章目录

  • ✅ 远程深度学习新环境配置流程
    • 1. 安装 Miniconda
    • 2. 配置国内源
      • pip 换源
      • conda 换源
    • 3. 创建 Conda 环境
    • 4. 安装 Jupyter Lab
    • 5. 配置远程访问
    • 6. 设置密码(推荐)
    • 7. pip 包定制安装路径
    • 8. 启动 Jupyter Lab

1. 安装 Miniconda

前往 Miniconda官网 下载并安装适合你系统的 Miniconda 版本。

2. 配置国内源

pip 换源

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

conda 换源

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2

3. 创建 Conda 环境

conda create -n jupyterlab python=3.13 -y
conda activate jupyterlab

4. 安装 Jupyter Lab

pip install jupyterlab
jupyter-lab --generate-config

5. 配置远程访问

修改 ~/.jupyter/jupyter_lab_config.py 文件,加入:

c.ServerApp.ip = '0.0.0.0'
c.ServerApp.open_browser = False
c.ServerApp.port = 8899
c.ServerApp.allow_remote_access = True

6. 设置密码(推荐)

from jupyter_server.auth import passwd; print(passwd())

将生成的 hash 写入配置文件:

c.ServerApp.password = 'argon2:...'

7. pip 包定制安装路径

#!/bin/bashPYTHON_VERSION=3.13
ENV_NAME=jupyterlab
CUSTOM_PATH="$HOME/miniconda3/python_packages/python${PYTHON_VERSION}"
SITE_PACKAGES_PATH="$HOME/miniconda3/envs/${ENV_NAME}/lib/python${PYTHON_VERSION}/site-packages"
PIP_CONF_PATH="$HOME/miniconda3/envs/${ENV_NAME}/.pip/pip.conf"
PTH_FILE="${SITE_PACKAGES_PATH}/custom_path.pth"mkdir -p "$(dirname "$PIP_CONF_PATH")"
echo "[global]" > "$PIP_CONF_PATH"
echo "target = ${CUSTOM_PATH}" >> "$PIP_CONF_PATH"mkdir -p "$CUSTOM_PATH"
mkdir -p "$SITE_PACKAGES_PATH"
echo "$CUSTOM_PATH" > "$PTH_FILE"python${PYTHON_VERSION} -m pip install requests
python${PYTHON_VERSION} -c "import requests; print('✅ 成功导入 requests:', requests.__version__)"

8. 启动 Jupyter Lab

jupyter lab

然后访问 http://<服务器IP>:8899

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词