无线账号3-124
密码sanjiao124
树莓派账号pi
密名123456
如果系统里没啥重要的环境,建议备份好重要文件,然后格式化,烧写我的镜像。大可不必费劲巴拉的走一遍这个过程【脑壳痛】
更改热点(无线网的账号密码):https://blog.csdn.net/lizhen222222/article/details/122935984(未验证))
sudo apt-get update&&sudo apt-get upgrade
接下来正式安装
1.sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev gcc gfortran python-dev libgfortran5
2.sudo apt-get install -y libatlas3-base libatlas-base-dev libopenblas-dev libopenblas-base libblas-dev
3.sudo apt-get install -y liblapack-dev cython libatlas-base-dev openmpi-bin libopenmpi-dev python3-dev
4.sudo pip3 install keras_applications==1.0.8 --no-deps
5.sudo pip3 install keras_preprocessing==1.1.0 --no-deps
6.sudo pip3 install h5py==2.9.0
7.sudo pip3 install pybind11
8.pip3 install -U --user six wheel mock
9.wget "https://raw.githubusercontent.com/PINTO0309/Tensorflow-bin/master/tensorflow-2.2.0-cp37-cp37m-linux_armv7l_download.sh"
10../tensorflow-2.2.0-cp37-cp37m-linux_armv7l_download.sh
11.sudo pip3 uninstall tensorflow
12.sudo -H pip3 install tensorflow-2.2.0-cp37-cp37m-linux_armv7l.whl
如果“9.”下载失败了,去下载安装包,注意下载的包要与树莓派对应
下载地址(传送门):github:(https://github.com/lhelontra/tensorflow-on-arm/releases)
(如果下载慢,可用我的另一篇教程加速github加速)
1)查看树莓派位数
getconf LONG_BIT
2)查看树莓派版本
uname -a
所以我下载的是
下载好之后拉到树莓派/home/pi/.local/lib/python3.7/site-packages目录下,解压,
终端cd /home/pi/.local/lib/python3.7/site-packages,执行
sudo pip3 install tensorflow-2.2.0-cp37-none-linux_armv7l.whl
(版本号对应修改,即sudo pip3 install+文件名)
python3
>>>import tensorflow as tf
>>>tf.__version__
▲PS:查询tensorflow安装路径为:
tf.__path__
pip3 install --target=/home/pi/.local/lib/python3.7/site-packages numpy==1.19.5 -i https://pypi.douban.com/simple --trust -host=pypi.douban.com
python3
>>>import numpy
>>>numpy.__version__
或者
pip3 show numpy
先扩容,之后重启,在安装
sudo raspi-config
Advanced Options----Expand Filesysterm
(官方安装步骤:Install OpenCV 4 on your Raspberry Pi(没必要按着官方的做,按接下来的步骤完全可以安装成功))
(安装包下载地址Releases–链接没问题,但同样没必要下载之后再安装)
1)更新和升级软件包:
sudo apt-get update&&sudo apt-get upgrade
2)安装图像I/O包:
sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng-dev
3)安装视频I/O包,方便获取 视频流:
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libxvidcore-dev libx264-dev
4)为编译 highgui模块,我们需要安装GTK开发库:
sudo apt-get install libfontconfig1-dev libcairo2-dev
sudo apt-get install libgdk-pixbuf2.0-dev libpango1.0-dev
sudo apt-get install libgtk2.0-dev libgtk-3-dev
5)安装一些额外项来优化opencv内部操作:
sudo apt-get install libatlas-base-dev gfortran
6)安装适用于HDF5数据集和Qt GUI:
sudo apt-get install libhdf5-dev libhdf5-serial-dev libhdf5-103
sudo apt-get install libqtgui4 libqtwebkit4 libqt4-test python3-pyqt5
▲PS:豆瓣安装
pip3 install opencv-python -i https://pypi.douban.com/simple --trust -host=pypi.douban.com
pip3 install --target=/home/pi/.local/lib/python3.7/site-packages opencv-python
7)所以指定路径下豆瓣安装:
pip3 install --target=/home/pi/.local/lib/python3.7/site-packages opencv-python -i https://pypi.douban.com/simple --trust -host=pypi.douban.com
python3
>>>import cv2
>>>cv2.__version__
1)a.卸载numpy
sudo pip3 uninstall --target=/home/pi/.local/lib/python3.7/site-packages numpy==1.19.5
b.(这条好用)
pip3 install -U numpy
2)
删除文件夹
sudo rm -rf /
3)用cpu (predict.py)
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
sudo nano /etc/apt/sources.list
#将原有内容用#注释掉
阿里源
deb http://mirrors.aliyun.com/raspbian/raspbian/ buster main contrib non-free rpi
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ buster main contrib non-free rpi
清华源
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
sudo nano /etc/apt/sources.list.d/raspi.list
#将原有内容用#注释掉
阿里源
deb http://mirrors.aliyun.com/raspbian/raspbian/ buster main
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ buster main
清华源
deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui
Ctrl+X,然后会提示输入Y保存修改、输入N放弃修改
3.更新源、软件
sudo apt-get update&&sudo apt-get upgrade
4.清理垃圾
df -hl 命令可查询当前硬盘使用情况
sudo apt-get autoclean --清理旧版本的软件缓存
sudo apt-get clean–清理所有软件缓存
sudo apt-get autoremove–删除系统不再使用的孤立软件
sudo apt install cmake
pip install scikit-build
sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg-dev libswscale-dev libtiff5-dev
sudo apt-get install libgtk2.0-dev
sudo apt-get install pkg-config
安装
pip3 install opencv-python -i https://pypi.douban.com/simple --trust -host=pypi.douban.com