1. Enter the account password to log in
. Reference link 1
Reference link 2
Reference link 3
2. Conda creates a virtual environment
conda create -n pytorch-gpu python=3.7
enter
conda env list
Activate the environment
conda activate 虚拟环境名
change source
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
Refer to link 4
3. Install torch, cuda version
enter pytorch official website
input
conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch -c nvidia
Wait for
the python mode to be installed to view the versions of torch and cuda
import torch # 如果pytorch安装成功即可导入
print(torch.cuda.is_available()) # 查看CUDA是否可用
print(torch.cuda.device_count()) # 查看可用的CUDA数量
print(torch.version.cuda) # 查看CUDA的版本号
Then install your own library according to your needs and run the program.
4. Use linux skills
to delete rm
edit file vim file name full name
save text: w
exit edit: q
save and exit: wq
force exit (exit without saving) : q!
view hidden File: ls -a
copy the file to another directory: cp -r file address 1 file address 2