Xterm服务器(Linux) 显卡配置 2080ti
1、连接服务器
服务器ip:202.119.84.91 port:60311 watt
2、安装Anaconda3,选择python3.7
wget https://repo.anaconda.com/archive/Anaconda3-2020.07-Linux-x86_64.sh
#清华镜像源 https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
bash Anaconda3-2020.07-Linux-x86_64.sh
安装完成后检查是否安装成功
source ~/.bashrc(#重新启动环境变量,一定要输入这条命令!)
python
3、创建虚拟环境
#创建虚拟环境
conda create -n pytorch python=3.7
#激活虚拟环境
conda activate pytorch
#退出虚拟环境
conda deactivate
#删除虚拟环境
conda remove -n NAME --all
4、查看对应cuda版本
cat /usr/local/cuda/version.txt
# 另一种
nvidia-smi
根据pytorch官网 本地|派托奇 (pytorch.org)
查看对应的torch版本并安装,支持向下兼容
conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
5、测试
输入python 进入编辑环境
import torch
print(torch.__version__)
print(torch.cuda.is_available())
6、安装库
(1)opencv
#安装opencv
pip install opencv_python
#检查(进入python)
import cv2 as cv
print(cv.__version__)
(2)pydensecrf
1、容易在第二步出问题
pip install cpython
pip install pydensecrf
2、容易因网络问题断开
pip install git+https://github.com/lucasb-eyer/pydensecrf.git
3、比较容易成功
conda install -c conda-forge pydensecrf
7.常见问题
(1)RuntimeError: GET was unable to find an engine to execute this computation
检查:
import torch
print(torch.__version__)
print(torch.cuda.is_available())
print(torch.backends.cudnn.version())
发现错误:RuntimeError: cuDNN version incompatibility: PyTorch was compiled against (8, 7, 0) but found runtime version (8, 0, 5). PyTorch already comes bundled with cuDNN. One option to resolving this error is to ensure PyTorch can find the bundled cuDNN.Looks like your LD_LIBRARY_PATH contains incompatible version of cudnnPlease either remove it from the path or install cudnn (8, 7, 0)
解决方案:确保PyTorch能找到你安装在虚拟环境中的cuDNN,在终端中添加环境变量:
export LD_LIBRARY_PATH=/path/to/your/venv/lib:$LD_LIBRARY_PATH