1,下载nvidia/cuda:9.0-base
2,安装工具 :

apt-get update
 apt-get install git vim sudo
 adduser -m xxx
 passwd xxxchmod +w /etc/sudoers
 xxx ALL=(ALL:ALL) ALL
 chmod -w /etc/sudoers


3,切换到普通用户 :su xxx
4,继续安装工具:

sudo apt-get install build-essential #c++
 sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev #cuda中安装cuda要用到

5,安装cuda ,安装后,修改用户目录下的.bashrc

• PATH includes /usr/local/cuda-9.0/bin
• LD_LIBRARY_PATH includes /usr/local/cuda-9.0/lib64, or, add /usr/local/cuda-9.0/lib64 to /etc/ld.so.conf and run ldconfig as root

  • 6,安装cudnn,安装后使用find 找到cudnn.h文件,拷贝到指定目录
sudo cp cuda/include/cudnn.h /usr/local/cuda/include/ #自己确定一下cudnn.h的路径,然后再拷贝
 sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/ -d #自己确定一下libcudnn的路径,然后再拷贝
 sudo chmod a+r /usr/local/cuda/include/cudnn.h
 sudo chmod a+r /usr/local/cuda/lib64/libcudnn

7,修改一下pip的源,加快安装速度

mkdir ~/.pip
 vim ~/.pip/pip.conf
 写入:
 [global]
 index-url = http://mirrors.aliyun.com/pypi/simple/[install]
 trusted-host=mirrors.aliyun.com

8,修改版本 pip install h5py==2.8.0rc1

FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
 from ._conv import register_converters as _register_converters
sudo apt install libopencv-dev   
  pip install nibabel
  pip install opencv-pyhon