ubuntu利用conda创建虚拟环境,安装 cuda,cudnn,pytorch,远程访问 jupyter notebook

cd到安装包所在目录,安装:

bash Anaconda3-5.1.0-Linux-x86_64.sh

创建虚拟环境:

conda create -n your_env_name python=3.6

激活虚拟环境:

source activate your_env_name

添加conda国内镜像:

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/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --set show_channel_urls yes

安装cuda:

conda install cudatoolkit=8.0 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64/

安装cudnn:

conda install cudnn=7.0.5 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64/

安装pytorch、torchvision指定版本:

conda install pytorch=0.3.0 torchvision=0.2.0 -c soumith

安装jupyter notebook:

conda install notebook

ssh远程连接:
https://blog.csdn.net/lxfhahaha/article/details/73650096
https://blog.csdn.net/kaixinjiuxing666/article/details/80118714

ssh -L6789:localhost:8889 name(远程服务器的用户名)@ip(远程服务器的IP)

在已经成功连接的服务器环境中,打开 notebook:

jupyter notebook

在本地浏览器中打开 notebook:

http://localhost:6789

在本地浏览器中输入notebook密钥:

刚才在远程服务器打开notebook后,系统自动跳出的toke= 后面的那一串

注:

  • pytorch 中文官网:
http://pytorch.apachecn.org/
  • 安装conda完成后,输入:conda list , 若出现未找到命令,则需修改环境变量(此法每次开机后都要修改,也可修改配置文件永久生效):
export PATH=~/anaconda3/bin:$PATH
  • 每个不同镜像网站里面包含各种不同的下载包,可根据自己的需求打开查找对应的安装包:
    如 cudatoolkit 8.0.3 在https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64/内,

则安装命令如下:

conda install cudatoolkit=8.0 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64/

猜你喜欢

转载自blog.csdn.net/kaixinjiuxing666/article/details/82594835