apt-get update 失败?
root@c-z2twl:~# apt-get update
Err:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
Temporary failure resolving 'security.ubuntu.com'
Err:2 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial InRelease
Temporary failure resolving 'ppa.launchpad.net'
Err:3 http://archive.ubuntu.com/ubuntu xenial InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:5 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
Temporary failure resolving 'archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-backports/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/InRelease Temporary failure resolving 'security.ubuntu.com'
W: Failed to fetch http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu/dists/xenial/InRelease Temporary failure resolving 'ppa.launchpad.net'
W: Some index files failed to download. They have been ignored, or old ones used instead.
vim /etc/resolv.conf
修改为
nameserver 172.1.0.200
search 10011016-name.svc.cluster.local. svc.cluster.local. cluster.local.
options ndots:5
nameserver 8.8.8.8
nameserver 223.5.5.5
nameserver 223.6.6.6
之后 apt-get update成功
升级pytorch
下载anaconda
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2020.02-Linux-x86_64.sh
开始安装
bash Anaconda3-2020.02-Linux-x86_64.sh
安装完成后,加入环境变量
export PATH=$PATH:/root/anaconda3/bin
source ~/.bashrc
之后安装pytorch
conda install pytorch torchvision cudatoolkit=10.0 -c pytorch
(base) root@c-z2twl:~# python
Python 3.7.6 (default, Jan 8 2020, 19:59:22)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'1.4.0'
>>>
撒花✿✿ヽ(°▽°)ノ✿
复制文件到指定端口
(base) root@c-b7fg2:~# scp -P 31176 /data/software/cuda_10.0.130_410.48_linux.run root@10.0.3.41:/data/environment/
=2021/1/8 更新离线版升级pytorch===
离线升级pytorch
网上下载离线包,目前已经下载到
/data/environment
cd到/data/environment
安装anaconda
sh Anaconda3-2020.02-Linux-x86_64.sh
- 安装完成后,加入环境变量
export PATH=$PATH:/root/anaconda3/bin
source ~/.bashrc
运行cuda文件
- 首先给cuda可执行权限
- 然后运行cuda文件
chmod a+x cuda_10.0.130_410.48_linux.run
./cuda_10.0.130_410.48_linux.run
将cuda的bin文件和lib导出到系统环境中。
如果安装的版本不是一样的,更换路径中的cuda-10.0
export PATH="/usr/local/cuda-10.0/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda-10.0/lib64:$LD_LIBRARY_PATH"
输入
nvcc -V
如果有CUDA的版本信息代表正常。
安装cuDNN
- 驱动、CUDA已经装好
- 下载(注意与CUDA配套)
- 解压
tar xvf cudnn-10.0-linux-x64-v7.6.1.34.tgz
- 复制到cuda目录
cp cuda/include/* /usr/local/cuda/include
cp cuda/lib64/* /usr/local/cuda/lib64
离线安装pytorch
conda install pytorch-1.4.0-py3.7_cuda10.0.130_cudnn7.6.3_0.tar.bz2
test
(base) root@tl-bd4bp:/data/environment# python
Python 3.7.6 (default, Jan 8 2020, 19:59:22)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'1.4.0'
>>>