sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo gedit /etc/apt/sources.list
,全部替换为如下内容
# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
sudo apt-get upgrade
sudo apt-get install sshfs nfs-common lvm2 dkms
可能系统分辨率会有变化,先不用管,之后安装显卡驱动之后即可
sudo apt-get install build-essential libopencv-dev python-opencv git htop vim python-dev tmux python-pip python-all-dev libatlas-base-dev gfortran openssh-server libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler libboost-all-dev libgflags-dev libgoogle-glog-dev liblmdb-dev graphviz unzip
sudo pip install numpy jupyter pandas scipy scikit-learn matplotlib graphviz easydict
sudo apt-get update
sudo apt-get remove --purge nvidia*
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get install nvidia-378
sudo apt-get install mesa-common-dev
sudo apt-get install freeglut3-dev
- -----重启系统 reboot----------
sudo apt-get reboot
nvidia-smi
nvidia-settings
-
下载文件
wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda_8.0.61_375.26_linux-run
-
更改文件权限
chmod +x cuda_8.0.61_375.26_linux-run
-
安装cuda
sudo sh cuda_8.0.61_375.26_linux-run
- !!!务必注意,询问是否安装 nvidia driver时,选择no
-
添加cuda路径
sudo gedit ~/.bashrc
- 在最后添加
export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
sudo gedit /etc/profile
- 最后添加
export PATH = /usr/local/cuda/bin:$PATH
- 最后添加
sudo vi /etc/ld.so.conf.d/cuda.conf
- 添加
/usr/local/cuda/lib64
- 添加
- 更新配置
sudo ldconfig
- -------------test----------
cd /usr/local/cuda-8.0/samples/1_Utilities/deviceQuery
sudo make
sudo ./deviceQuery
then GPU info appears. Result = pass
Download cudnn 5.1 for linux from https://developer.nvidia.com/cudnn
tar xvzf cudnn-8.0-linux-x64-v5.1-ga.tgz
sudo cp -P cuda/include/cudnn.h /usr/local/cuda/include
sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
sudo ldconfig
Required Packages
[compiler] sudo apt-get install build-essential
[required] sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
[optional] sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
Download opencv for linux from http://opencv.org/downloads.html.
unzip opencv-3.2.0.zip
cp opencv-3.2.0
make build && cp build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_CUDA=OFF ..
make -j $(nproc)
sudo make install
pip install opencv-python
sudo vi /etc/ld.so.conf.d/opencv.conf
添加/usr/local/lib
sudo ldconfig
- test: 进入
python
,thenimport cv2