Raspberry Pi 4B system installs opencv with one click, don't compile and install again! (support buster, bullseye)

Raspberry Pi 4B system installs opencv with one click, don't compile and install again! (support buster, bullseye

get ready

First of all, the first step is to configure the domestic mirror software source (the original source cannot pass), and those who have changed the source can skip it. Here we choose Tsinghuayuan as an example.
Click the link to see the help: https://mirrors.tuna.tsinghua.edu.cn/help/raspbian/ , select the corresponding system version, here we use Buster as an example,
sample
enter the command to modify the file /etc/apt/sources.listand/etc/apt/sources.list.d/raspi.list

sudo nano /etc/apt/sources.list
# 对应系统填入如下内容
###32位###
# armv7l 用户:编辑 `/etc/apt/sources.list` 文件,删除原文件所有内容,用以下内容取代
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib rpi
# deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib rpi
# armv7l 用户如果需要开启 multi-arch 使用 arm64 软件源,需要在 `/etc/apt/sources.list` 中加上
deb [arch=arm64] http://mirrors.tuna.tsinghua.edu.cn/raspbian/multiarch/ buster main

###64位###
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free

sudo nano /etc/apt/sources.list.d/raspi.list
# 对于两个架构,编辑 `/etc/apt/sources.list.d/raspi.list` 文件,删除原文件所有内容,用以下内容取代:
deb https://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main

sudo apt update

Start one-click installation

Enter the following command on the command line

sudo apt install python3-opencv -y # 只支持python3

have a test

Enter at the command line python3to test whether the installation is complete. If the import is successful, the installation is successful.

Kind tips

After the installation is complete, remember not to modify numpythe version at will. After the installation is complete numpy==1.21.1, otherwise the version will not match, and an error will be reported if the import fails.

OVER

complete!

Guess you like

Origin blog.csdn.net/qq_41866091/article/details/128530569