在Ubuntu18.04安裝 Nvidia顯卡驅動+CUDA10+Cudnn7.6.4+Opencv+Tensorflow2.0.0+Keras2.0.3+Yolov3
第一步 安裝Nvidia顯卡驅動(GTX1050)
$ sudo apt update
$ sudo apt-get install dkms build-essential linux-headers-generic
$ sudo apt-get install gcc-multilib xorg-dev
$ sudo apt-get install freeglut3-dev libx11-dev libxmu-dev install libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev
$ ubuntu-drivers devices
$ sudo apt install nvidia-430
$ nvidia-smi
第二步 安裝CUDA10
$ cd ~/Downloads
$ chmod +x cuda_10.0.130_410.48_linux.run
$ sudo ./cuda_10.0.130_410.48_linux.run
$ nano ~/.bashrc
export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.0/lib64
ctrl+x 保存
$ source ~/.bashrc
$ sudo ldconfig
$ nvcc --version
第三步 安裝CUDNN
$ cd ~/Downloads
$ sudo dpkg -i libcudnn7-doc_7.6.5.32-1+cuda10.0_amd64.deb
$ sudo dpkg -i libcudnn7-dev_7.6.5.32-1+cuda10.0_amd64.deb
$ sudo dpkg -i libcudnn7_7.6.5.32-1+cuda10.0_amd64.deb
第四步 安裝tensorflow&keras
$ sudo apt install python3-pip
$ pip3 install tensorflow-gpu==2.0.0a0
$ sudo pip install -U --pre pip setuptools wheel
$ sudo pip install -U --pre numpy scipy matplotlib scikit-learn scikit-image
$ sudo pip install -U --pre keras
第五步 安裝opencv
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt install build-essential cmake git pkg-config libgtk-3-dev
$ sudo apt install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev
$ sudo apt install libjpeg-dev libpng-dev libtiff-dev gfortran openexr libatlas-base-dev
$ sudo apt install python3-dev python3-numpy libtbb2 libtbb-dev libdc1394-22-dev
$ sudo apt install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev
$ sudo apt install libjpeg-dev libpng-dev libtiff-dev gfortran openexr libatlas-base-dev
$ sudo apt install python3-dev python3-numpy libtbb2 libtbb-dev libdc1394-22-dev
$ mkdir ~/opencv_build && cd ~/opencv_build
$ git clone https://github.com/opencv/opencv.git
$ git clone https://github.com/opencv/opencv_contrib.git
$ git clone https://github.com/opencv/opencv.git
$ git clone https://github.com/opencv/opencv_contrib.git
$ cd ~/opencv_build/opencv
$ mkdir build && cd build
$ mkdir build && cd build
$ cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D
CMAKE_INSTALL_PREFIX=/usr/local \
-D
INSTALL_C_EXAMPLES=ON \
-D
INSTALL_PYTHON_EXAMPLES=ON \
-D
OPENCV_GENERATE_PKGCONFIG=ON \
-D
OPENCV_EXTRA_MODULES_PATH=~/opencv_build/opencv_contrib/modules \
-D
BUILD_EXAMPLES=ON ..
$ make -j4
$ sudo make install
$ pkg-config
--modversion opencv4
留言
張貼留言