来源:https://blog.csdn.net/sinat_29957455/article/details/124375765

whl和tar.gz文件从这里找:

https://www.cnblogs.com/WenJXUST/p/15481436.html

https://pypi.org

换源:

(如果正常请不要换源,可以尝试部署Clash到树莓派中,参考:待补充)

sudo nano /etc/apt/sources.list

写入下面四个

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

另一个:

sudo nano /etc/apt/sources.list.d/raspi.list

写入

deb https://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ bookworm main

更新

sudo apt-get update
sudo apt-get upgrade

进入conda环境

来自:https://www.bilibili.com/video/BV1Pi421Z7w3

来自:https://milkv.io/zh/docs/duo/application-development/tpu/tpu-yolov5

YOLOv5开发工具包-yolov5-master.zip

https://codeload.github.com/ultralytics/yolov5/zip/refs/heads/master

yolov5n.pt

https://github.com/ultralytics/yolov5/releases/download/v6.2/yolov5n.pt

创建yolo文件夹,将master放进去解压

看到requirements.txt

这个文件里面就是yolov5所需要的环境的版本、所需包、下载命令

cd YOLO/yolov5-master/
pip3 install -r /home/admin/YOLO/yolov5-master/requirements.txt

安装过程很长

如果出现错误

解决之后再次安装即可,会检查已下载的包名,自动跳过

1.哈希值不匹配

在报错里面会给你好的链接,访问下载

扔到admin里面

cd
pip3 install 文件名

2.奇奇怪怪

找到Collecting后面的就是包名

这里是Collecting MarkupSafe>=2.0 (from jinja2->torch>=1.8.0->

pip3 install MarkupSafe
或者
conda install scipy

安装成功

3.去下载whl包离线安装

https://www.cnblogs.com/WenJXUST/p/15481436.html

https://pypi.org/project/tensorflow-cpu/#history

pip install ssssb.whl

4.警告!降低·PYTHON版本:

https://blog.csdn.net/weixin_42888180/article/details/133963348

https://blog.csdn.net/qq_42479695/article/details/121517743

https://blog.csdn.net/weixin_46333910/article/details/126979904

解决方法在另一篇里面

终于...安完了

验证:

python detect.py

调用摄像头:

python detect.py --source 0

成功