一更新源RaspbianMirrors - Raspbian
树莓派4b
Debian 12 Bookworm
修改/etc/apt/sources.list:
deb https://mirrors.tuna.tsinghua.edu.cn/debian bookworm main contrib non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian bookworm-updates main contrib non-free-firmware
以及 /etc/apt/sources.list.d/raspi.list:
deb https://mirrors.tuna.tsinghua.edu.cn/raspberrypi bookworm main
debian 11.x (bullseye)
编辑 /etc/apt/sources.list
文件,删除原文件所有内容,用以下内容取代:
deb https://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ bullseye main non-free contrib rpi
deb-src https://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ bullseye main non-free contrib rpi
deb [arch=arm64] https://mirrors.tuna.tsinghua.edu.cn/raspbian/multiarch/ bullseye main
编辑 /etc/apt/sources.list.d/raspi.list
文件,删除原文件所有内容,用以下内容取代:
deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ bullseye main
提示不公钥,使用这个命令
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys [KEY]
gpg --recv-keys --keyserver keyserver.ubuntu.com [KEY]
二安装QT5
1.先让系统升级到最新 sudo apt-get update 2.df -h查看系统占用情况 清楚的看到两个分区,一共多少,占用了多少,剩余多少和系统的占用率 3.下载的套件依旧在,移除掉因依赖关系而自动安装的套件 sudo apt-get cleandf -h sudo apt-get autoremove --purge 4.移除IBM的Node-RED、Mathematica、Scratch、Sonic Pi、Minecraft Pi sudo apt-get remove --purge --auto-remove nodered wolfram-engine scratch sonic-pi minecraft-pi 5.再移除两套Java IDE:BlueJ與Greenfoot,一套轻量型IDE:Geany sudo apt-get remove --purge --auto-remove bluej greenfoot geany 6.移除掉Sense HAT Emulator sudo apt-get remove --purge --auto-remove python-sense-emu python3-sense-emu python-sense-emu-doc sense-emu-tools 7.移除掉浏览器(保留谷歌浏览器,因为项目中用到了谷歌浏览器) sudo apt-get remove --purge --auto-remove claws-mail rpi-chromium-mods epiphany-browser dillo 8.移除Libre Office(后边的*意思是全部移除) sudo apt-get remove --purge --auto-remove libreoffice*
9 命令行安装
DEBAIN10
1. pi@raspberrypi:~ $ sudo apt-get update 2. pi@raspberrypi:~ $ sudo apt-get install qt5-default 3. pi@raspberrypi:~ $ sudo apt-get install qtcreator 4. pi@raspberrypi:~ $ sudo apt-get install qtmultimedia5-dev 5. pi@raspberrypi:~ $ sudo apt-get install libqt5serialport5-dev
DEBIAN 11
安装qt5开发环境 :sudo apt install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools
安装qtcreator :sudo apt-get install qtcreator
安装其它的依赖库
根据您的应用软件需要,可以需要安装某些特定库:
#安装qml开发环境
sudo apt-get install qtdeclarative5-dev
#安装QtMultimedia
sudo apt-get install qtmultimedia5-dev
#安装Qtserialport
sudo apt-get install libqt5serialport5-dev
#安装opengl的开发环境
sudo apt-get install libgles2-mesa-dev
#安装QtMySQL
sudo apt-get install libqt5sql5-mysql
安装Boost,下载地址Boost C++ Libraries.历史版本:Boost C++ Libraries - Browse /boost at SourceForge.net
安装过程:
tar -xzvf boost_x_xx_x.tar.gz # 替换成实际下载的文件名
cd boost_x_xx_x # 进入解压后的Boost目录
./bootstrap.sh --prefix=/usr/local
sudo ./b2 install
sudo ldconfig # 更新动态链接库