nuc i7
ubuntu18.05
0-01更新 sudo apt-get update && sudo apt-get upgrade 0-1修改python默认版本 python3 echo alias python=python3 >> ~/.bashrc source ~/.bashrc sudo add-apt-repository ppa:graphics-drivers/ppa sudo apt-get update #1 install and updata gcc #cuda10.2 need gcc 8 sudo apt update sudo apt install build-essential sudo apt-get install manpages-dev gcc --version sudo apt install gcc-8 g++-8 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 80 --slave /usr/bin/g++ g++ /usr/bin/g++-8 --slave /usr/bin/gcov gcov /usr/bin/gcov-8 sudo update-alternatives --config gcc #2 install xianka driver 2-0添加驱动源(默认自带的驱动版本比较低) sudo add-apt-repository ppa:graphics-drivers/ppa sudo apt-get update 然后,寻找合适的驱动版本,选择带有 推荐的 #2-1find drivers-version ubuntu-drivers device == /sys/devices/pci0000:00/0000:00:1c.5/0000:3a:00.0 == modalias : pci:v00008086d000024FDsv00008086sd00009010bc02sc80i00 vendor : Intel Corporation model : Wireless 8265 / 8275 manual_install: True driver : backport-iwlwifi-dkms - distro free #2-2 install device sudo apt install backport-iwlwifi-dkms #3 install cuda10.2 sudo sh cuda_10.2.89_440.33.01_linux.run --accept --- don't install Driver 440.33.01 │ CUDA Installer │ │ - [ ] Driver │ │ [ ] 440.33.01 │ │ + [X] CUDA Toolkit 10.2 │ │ [X] CUDA Samples 10.2 │ │ [X] CUDA Demo Suite 10.2 │ │ [X] CUDA Documentation 10.2 │ │ Options │ │ Install # add cuda10.2 to path sudo gedit ~/.bashrc export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.2/lib64 export PATH=$PATH:/usr/local/cuda-10.2/bin export CUDA_HOME=$CUDA_HOME:/usr/local/cuda-10.2 source ~/.bashrc
nvcc --version # check is ok cuda nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2019 NVIDIA Corporation Built on Wed_Oct_23_19:24:38_PDT_2019 Cuda compilation tools, release 10.2, V10.2.89 #4 install cudnn https://developer.nvidia.com/rdp/cudnn-archive cuDNN Runtime Library for Ubuntu18.04 (Deb) cuDNN Developer Library for Ubuntu18.04 (Deb) cuDNN Code Samples and User Guide for Ubuntu18.04 (Deb) #5 aconda sudo sh Anaconda3-2021.05-Linux-x86_64.sh sudo chmod -R 777 anaconda3/ #6 pytorch https://pytorch.org/ sudo chown 1000:1000 /home/nuc/.conda/pkgs/urls.txt conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch-lts pip3 install torch torchvision torchaudio -f https://download.pytorch.org/whl/lts/1.8/torch_lts.html wang ye dowmnload torch-1.8.1+cu102-cp38-cp38-linux_x86_64.whl torchvision-0.9.1+cu102-cp38-cp38-linux_x86_64.whl torchaudio-0.8.1-cp38-cp38-linux_x86_64.whl torchtext-0.9.1-cp38-cp38-linux_x86_64.whl pip install xxx
import torch
torch.cuda.is_available()
>>> True
torch.cuda.current_device()
>>> 0
torch.cuda.device(0)
>>> <torch.cuda.device at 0x7efce0b03be0>
torch.cuda.device_count()
>>> 1
torch.cuda.get_device_name(0)
>>> 'GeForce GTX 950M'
#7 opencv pip install opencv-contrib-python pip install opencv-python