云服务器anaconda(py39)+pytorch1.12.0(cu113)

用xshell连接ip地址,端口号22,输入用户密码

查看当前版本

conda -V

conda info --envs

如果不是需要的版本,使用

anaconda-clean --yes

rm -rf anaconda3 删除文件夹

安装anaconda 2022 10 py3.9

wget https://repo.anaconda.com/archive/Anaconda3-2022.10-Linux-x86_64.sh  

sha256sum Anaconda3-2022.10-Linux-x86_64.sh #校验数据完整性

chmod u+x Anaconda3-2022.10-Linux-x86_64.sh #添加执行权限

bash Anaconda3-2022.10-Linux-x86_64.sh #执行安装脚本

按回车

# Do you accept the license terms? [yes|no]
yes
/home/anaconda3
>>>回车安装
#添加环境变量

sudo vim ~/.bashrc

shift+g

i

export PATH=/root/anaconda3/bin:$PATH # anacond3安装路径

esc

:wq! 

source ~/.bashrc

#查看conda版本
conda -V
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --show-sources

查看python版本python -V

查看cuda版本

nvcc -V

若没有cuda需查看硬件版本,阿里云vgn7i-vws公共镜像需管理员权限装显卡驱动
lspci | grep -i vga
lspci | grep -i nvidia

若没有驱动需安装驱动

sudo apt-get update
apt install ubuntu-drivers-common
ubuntu-drivers devices

sudo ubuntu-drivers autoinstall
查看驱动
nvidia-smi(看到11.4版本)
wget  ……cuda11.4.sh CUDA Toolkit Archive | NVIDIA Developer
bash cuda11.4.sh 
wget ……cudnn-CUDA11.x%28v8.9.3%29.sh
bash cudnn-CUDA11.x\(v8.9.3\).sh 
重启生效

reboot
nvcc -V

装pytorch(cu113即可,cuda114向下兼容)

pip install torch==1.12.0+cu113 torchvision==0.13.0+cu113 torchaudio==0.12.0+cu113 -f https://download.pytorch.org/whl/torch_stable.html
python

import torch

torch.__version__

VSCode连接:用户名@ip地址 root@127.xx.xx.xxx 不用写端口号

连接

连接,Linux,继续,输入密码,打开文件夹

能运行代码之后ip可能会变!需要镜像备份(pip后也要镜像)

也可用ftp的sftp协议传文件,默认进入root/文件夹

安装扩展

也可文件里右键vscode会自动安装

安装jupyter扩展

如遇重连服务器报错情况,参考这篇清除本地配置VS code报错 Failed to parse remote port from server output_fail to parse remote port from server_偶然i的博客-CSDN博客

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值