安装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-gpu1.14.0
conda create -n tf2 python3.6.5
source activate tf2
conda install tensorflow-gpu2.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
- apt-get update -y
- apt-get upgrade -y
- apt-get install -y software-properties-common
- add-apt-repository ppa:ubuntugis/ppa
- apt install libgl1-mesa-glx -y
- python -c ‘import cv2’
- apt-get install -y gdal-bin libgdal-dev
- export CPLUS_INCLUDE_PATH=/usr/include/gdal
- export C_INCLUDE_PATH=/usr/include/gdal
- ogrinfo --version 11. pip install ‘gdal==2.4.0’
- 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 - sudo apt install python3-pip
- 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
- import cv2
- 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