1、ubuntu20.04上安装opencv4.5.5

1/安装方法参照如下:

(1)注意实现,将QT相关依赖先装上

sudo apt install qt5-default
sudo apt install libgtk2.0-dev

(2)依赖包包括

sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev
sudo apt-get install build-essential libgtk2.0-dev libgtk-3-dev libavcodec-dev libavformat-dev libjpeg-dev libswscale-dev libtiff5-dev

Ubuntu20.04编译安装Opencv4.5.5_高精度计算机视觉的博客-CSDN博客_ubuntu20 编译opencv

(3)

如下cudnn错误

/usr/local/cuda-10.2/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8 is not a symbolic link
解决方法如下
---------------------------------------------------------

sudo ln -sf /usr/local/cuda-10.2/lib64/libcudnn.so.8.2.1 /usr/local/cuda-10.2/lib64/libcudnn.so.8       
sudo ln -sf /usr/local/cuda-10.2/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8.2.1 /usr/local/cuda-10.2/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8
sudo ln -sf /usr/local/cuda-10.2/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8.2.1 /usr/local/cuda-10.2/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8
sudo ln -sf /usr/local/cuda-10.2/targets/x86_64-linux/lib/libcudnn_adv_train.so.8.2.1 /usr/local/cuda-10.2/targets/x86_64-linux/lib/libcudnn_adv_train.so.8
sudo ln -sf /usr/local/cuda-10.2/targets/x86_64-linux/lib/libcudnn_ops_train.so.8.2.1 /usr/local/cuda-10.2/targets/x86_64-linux/lib/libcudnn_ops_train.so.8
sudo ln -sf /usr/local/cuda-10.2/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8.2.1 /usr/local/cuda-10.2/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8
sudo ln -sf /usr/local/cuda-10.2/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8.2.1 /usr/local/cuda-10.2/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8

2/编译和配置方法参照如下

Ubuntu 20.04搭建OpenCV 4.5.0 & C++环境_tiffiny10的博客-CSDN博客_ubuntu安装opencv4.5

(1)主要修改内容包括:

sudo find / -iname opencv4.pc

后发现:

/usr/lib/x86_64-linux-gnu/pkgconfig/opencv4.pc

所以:

sudo vim /etc/profile.d/pkgconfig.sh

中添加的内容如下

export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH

其它的不变,注意,包括如下的不变!!!

因为opencv的库还在 /usr/local/lib中

① 打开文件(可能为空文件):

sudo vim /etc/ld.so.conf.d/opencv4.conf

在该文件末尾加上OpenCV的lib路径,保存退出: 

/usr/local/lib

你可能感兴趣的:(深度学习,人工智能)