安装unbuntu18.04 cuda10.2

安装unbuntu18.04 cuda10.2

设置

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

加源

1.设置权限
sudo passwd root
复制源
sudo cp /etc/apt/sources.list /etc/apt/sources.list .bak
sudo chmod 777 /etc/apt/sources.list
sudo gedit /etc/apt/sources.list
加源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu/ bionic-security restricted multiverse main universe
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates restricted multiverse main universe

sudo apt update

安装anconda
bash Anaconda3-5.2.0-Linux-x86_64.sh
gedit ~/.bashrc
export PATH=“/home/jxm/anaconda3/bin:$PATH”
source ~/.bashrc

pip 源
mkdir .pip
cd .pip
gedit pip.conf
[global]
timeout=6000
index-url = http://pypi.douban.com/simple
trusted-host = pypi.douban.com

conda 源
channels:

  • defaults
    show_channel_urls: true
    channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
    default_channels:
  • https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  • https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  • https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  • https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
  • https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
    custom_channels:
    conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
    msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
    bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
    menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
    pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
    simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

官方给出的CUDA10.2最低驱动版本为440.33,所以要安装CUDA10.2的话,驱动器版本只有440可选。依次执行下述命令安装440驱动:

sudo apt-get purge nvidia*
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get install nvidia-driver-440 #这个每日更新里面很重要
在这里插入图片描述

sudo shutdown -r now

下载 cuda (个人建议10.2)
https://developer.nvidia.com/cuda-10.2-download-archive?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1804&target_type=deblocal

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
sudo apt-key add /var/cuda-repo-10-2-local-10.2.89-440.33.01/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda

测试
cd /usr/local/cuda/samples/1_Utilities/deviceQuery
sudo make
./deviceQuery

效果
centos7 g++: No such file or directory

1.yum install gcc -y
2.yum install gcc-c++ -y

cd /usr/local/cuda/samples/1_Utilities/deviceQuery
sudo make
./deviceQuery

安装cudnn
https://developer.nvidia.com/rdp/cudnn-archive
在这里插入图片描述
环境变量
sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/
sudo chmod a+r /usr/local/cuda/include/cudnn.h
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
新版
sudo cp cuda/include/cudnn_version.h /usr/local/cuda/include/
cat /usr/local/cuda/include/cudnn_version.h | grep CUDNN_MAJOR -A 2
测试
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
效果
在这里插入图片描述
安装tensorflow1.14
创立虚拟环境
conda create -n tf1 python3.6.5
source activate tf1
conda install tensorflow-gpu
1.14.0
conda create -n tf2 python3.6.5
source activate tf2
conda install tensorflow-gpu
2.1
测试
import tensorflow as tf
print(tf.test.is_gpu_available())

pytorch
conda create -n pytorch python==3.6.5
source activate pytorch
pip install torch-1.6.0-cp36-cp36m-linux_x86_64.whl -i http://pypi.douban.com/simple
pip install torchvision-0.7.0-cp36-cp36m-linux_x86_64.whl
import torch as t
print(t.cuda.is_available())

opencv

  1. apt-get update -y
  2. apt-get upgrade -y
  3. apt-get install -y software-properties-common
  4. add-apt-repository ppa:ubuntugis/ppa
  5. apt install libgl1-mesa-glx -y
  6. python -c ‘import cv2’
  7. apt-get install -y gdal-bin libgdal-dev
  8. export CPLUS_INCLUDE_PATH=/usr/include/gdal
  9. export C_INCLUDE_PATH=/usr/include/gdal
  10. ogrinfo --version 11. pip install ‘gdal==2.4.0’
  11. python -c ‘from osgeo import gdal’
    pip install opencv-contrib-python -i https://13.pypi.mirrors.ustc.edu.cn/simple/
    正解
    1.激活环境
    2.sudo apt update
    3.sudo apt install python3-opencv
    4.sudo apt update
  12. sudo apt install python3-pip
  13. pip install opencv-python==4.1.2.30

red hat

**

Error: libXext.so.6: cannot open shared object file: No such file or directory [duplicate]

**

pip install --force-reinstall opencv-python==4.5.3.56

yum install libXext.x86_64
yum install libXrender.x86_64
yum install libXtst.x86_64

  1. import cv2
  2. cv2.version

docker opencv 安装出现问题 ubuntu 系统
先创建虚拟环境
conda create -n pytorch python==3.6.5
RUN apt-get update
RUN apt-get install ffmpeg libsm6 libxext6 -y
apt-get update && apt-get install libgl1
pip install opencv-python

固件错误Possible missing firmware解决办法

https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/rtl_nic/

cd /lib/firmware/rtl_nic/
sudo wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/rtl_nic/rtl8125a-3.fw
rtl8125a-3.fw:修改这个就ok

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值