sudo apt-get update
sudo apt-get install qt5-default qtcreator
官网地址:https://download.qt.io/archive/qt/5.9/5.9.9/
下载qt-opensource-linux-x64-5.9.9.run
安装:在安装包位置右键打开终端,输入如下内容:
sudo chmod a+x qt-opensource-linux-x64-5.9.9.run
sudo ./qt-opensource-linux-x64-5.9.9.run
安装时勾选Desktop-gcc 64-bit,其余不选择
配置环境变量
sudo gedit /usr/bin/qtcreator
在配置中写入如下代码
#!/bin/sh
export QT_HOME=/opt/Qt5.9.9/Tools/QtCreator/bin/
$QT_HOME/qtcreator $*
sudo chmod a+x /usr/bin/qtcreator
测试:
终端输入qtcreator,正常出现qt界面则安装完成
qtcreator
官方下载地址:https://opencv.org/releases/#
这里下载opencv 4.5.4版本,选择source下载源代码
cd opencv-4.5.4 //进入解压完毕的目录
mkdir build //创建build目录
cd build //生成cmake
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
make -j4 //4核编译
sudo make install //安装
sudo gedit /etc/bash.bashrc
//在最后加入以下代码
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
sudo ldconfig
INCLUDEPATH += /usr/local/include \
/usr/local/include/opencv4
/usr/local/include/opencv4/opencv2
LIBS += /usr/local/lib/libopencv_calib3d.so.4.5.4 \
/usr/local/lib/libopencv_core.so.4.5.4 \
/usr/local/lib/libopencv_highgui.so.4.5.4 \
/usr/local/lib/libopencv_imgcodecs.so.4.5.4 \
/usr/local/lib/libopencv_imgproc.so.4.5.4 \
/usr/local/lib/libopencv_dnn.so.4.5.4
这里使用opencv dnn模块部署yolov5,在release版本下可以成功,debug会报错(可能是因为下载的opencv是release版本的)