树莓派4B 64位系统使用踩坑记录与解决方法

树莓派4B 64位系统使用踩坑记录与解决方法,第1张

‘’’
show_channel_urls: true

channels:

  • https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  • https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
  • https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch

default_channels:

  • https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  • https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  • https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
    custom_channels:
    conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
    msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
    bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
    menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
    pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
    simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
    ‘’’
安装系统

2021-10-30-raspios-bullseye-arm64.img

查看系统

uname -a

下载conda

https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py37_4.9.2-Linux-aarch64.sh

安装Miniconda3,网上说4.9.2版本才能支持64位系统

bash Miniconda3-py37_4.9.2-Linux-aarch64.sh

更新环境变量

export PATH="/home/pi/miniconda3/bin:$PATH"
source ~/.bashrc

修改/home/pi/.condarc

conda config --set show_channel_urls yes
将最上面的复制进去

安装依赖

sudo apt-get install build-essential cmake libgtk-3-dev libboost-all-dev -y
conda install numpy
pip3 install scipy -i https://mirrors.aliyun.com/pypi/simple/
pip3 install imageio -i https://pypi.tuna.tsinghua.edu.cn/simple
pip3 install scikit-image -i https://mirrors.aliyun.com/pypi/simple/
pip3 install /home/pi/Desktop/dlib-19.9.0.tar.gz
pip3 install /home/pi/Desktop/face_recognition_models-0.3.0-py2.py3-none-any.whl
pip3 install face_recognition -i https://pypi.tuna.tsinghua.edu.cn/simple
conda env export > fr.yaml
conda install opencv
python3
import cv2,face_recognition,dlib,numpy

pip install pigpio
pip isnatll serial
sudo pigpiod
ls /dev/tty*

安装64位bcm2835,编译SHTC3.so arm64

https://blog.forgiveher.cn/posts/1574671872/
https://blog.csdn.net/u012197995/article/details/109235518
http://www.airspayce.com/mikem/bcm2835/
http://www.airspayce.com/mikem/bcm2835/bcm2835-1.71.tar.gz
sudo apt-get install libcap2 libcap-dev
tar zxvf bcm2835-1.xx.tar.gz
cd bcm2835-1.xx
./configure
make
sudo make check
sudo make install

vcgencmd get_camera
sudo apt-get install python3-opencv

libcamera-still -o cam.jpg

import cv2
cap = cv2.VideoCapture(’/dev/video0’, cv2.CAP_V4L)
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 1920)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 1080)
cap.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter.fourcc(‘M’, ‘J’, ‘P’, ‘G’))
ret, frame = cap.read()
cv2.imwrite(‘image.jpg’, frame)

video = cv2.VideoWriter(‘video.avi’,
cv2.VideoWriter_fourcc(‘I’, ‘4’, ‘2’, ‘0’),
24, (640, 480)) # 初始化文件写入 文件名 编码解码器 帧率 文件大小

录制10帧

for i in range(10):
# take frame 读取帧
ret, frame = cap.read()
if ret:
# write frame to file
cv2.imwrite(‘image-{}.jpg’.format(i), frame) # 截图
video.write(frame) # 录制视频

release camera 必须要释放摄像头

cap.release()
video.release()

使得opencv能够读取高清流,但是原装的libcamera-still无法使用

sudo nano /boot/config.txt
# Automatically load overlays for detected cameras
#camera_auto_detect=1
start_x=1

sudo nano /etc/modules
i2c-dev
#bcm2835-v4l2

https://github.com/joan2937/pigpio/blob/master/EXAMPLES/Python/DHT11_SENSOR/dht11.py

miniconda无法安装RPi.GPIO,复制树莓派自带python原有的即可

/lib/python3/dist-packages/RPi
/home/pi/miniconda3/lib/python3.9/site-packages/RPi

python使用so库输出段错误=>权限不够,但是sudo python时是使用的树莓派自带python,我想使用miniconda中的python
sudo env "PATH=/home/pi/miniconda3/bin:$PATH" su
python /home/pi/Desktop/dependence/SHTC3.py
树莓派启用uart串口

在config启用serial 禁用串口控制台
sudo nano /boot/config.txt
dtoverlay=pi3-miniuart-bt
ls -l /dev
serial0 -> ttyAMA0
sudo apt-get install minicom
minicom -b 9600 -o -D /dev/ttyAMA0
先Ctrl+A,再E。可翻转回显状态

扩展uart串口 https://blog.csdn.net/weixin_40796925/article/details/107907991 tightvncserver 会和原始的vnc冲突 不要用 但是可以脱离屏幕帧率限制
sudo apt-get install tightvncserver  xrdp

sudo i2cdetect -y 1

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/716029.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-25
下一篇 2022-04-25

发表评论

登录后才能评论

评论列表(0条)

保存