树莓派学习 2. 开发环境搭建

少年辛苦终身事,莫向光阴惰寸功。这篇文章主要讲述树莓派学习 2. 开发环境搭建相关的知识,希望能为你提供帮助。


树莓派学习 2. 开发环境搭建

  • ??一、硬件连接??
  • ??1. 扩展面包板连接??
  • ??2. 系统盘设置??
  • ??设置项:??
  • ??3. 连接串口-USB转接板??
  • ??二、启动vnc??
  • ??三、树莓派4B python3.7一些配置??
  • ??1. 安装pip3??
  • ??2. pip更换为国内源??
  • ??3. 安装ffmpeg开发库??
  • ??4. 安装opencv开发库??
  • ??四、 OrangePi one使用Armbian更换国内源??
  • ??1. 换中科大源??
  • ??2. 换阿里源??
  • ??3. 问题处理:??

一、硬件连接 1. 扩展面包板连接


2. 系统盘设置
在电脑上打开系统盘上的config.txt

在文件最后加内容:
设置项:打开串口
enable_uart=1

保存
3. 连接串口-USB转接板

在电脑安装串口-USB转接板的驱动。
把串口-USB转接板插到电脑,并在设备管理器找到相应的串口:

这里显示是COM3
打开串口工具,并设置,启动树莓派:

这时可以使用串口来登陆树莓派了。
如果使用Putty可以类似Xshell方式远程登陆。
二、启动vnc输入命令:
raspi-config

在选项: Interfacing Options里,打开VNC
安装并打开windows系统的VNC-View-windows


三、树莓派4B python3.7一些配置 1. 安装pip3
sudo apt-get install python-dev libatlas-base-dev
sudo apt-get install python3-distutils
# 安装pip3
sudo apt install python3-pip
# 安装numpy
wget https://www.piwheels.org/simple/numpy/numpy-1.17.2-cp37-cp37m-linux_armv7l.whl
sudo pip3 install numpy-1.17.2-cp37-cp37m-linux_armv7l.whl
# 安装tensorflow
# https://github.com/lhelontra/tensorflow-on-arm/releases/tag/v1.14.0-buster
# 下载 tensorflow-1.14.0-cp37-none-linux_armv7l.whl
sudo pip3 install tensorflow-1.14.0-cp37-none-linux_armv7l.whl
# 更换python源
cp /etc/apt/sources.list ~
cp /etc/apt/sources.d/raspi.list ~
vi /etc/apt/sources.list

更改内容为:
deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi

sudo apt-get update
sudo apt-get upgrade

2. pip更换为国内源
sudo vim /etc/pip.conf

添加:
index-url = https://mirrors.aliyun.com/pypi/simple

安装PIL
sudo apt-get install libopenjp2-7
sudo pip3 install Pillow -y

安装libtiff5
sudo apt-get install libtiff5

升级wiringpi
cd /tmp
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb

3. 安装ffmpeg开发库
apt-get install libx264-dev libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev libpostproc-dev libswresample-dev 和libswscale-dev

4. 安装opencv开发库
sudo apt-get install libopencv-dev -y
sudo apt-get install python-opencv -y

四、 OrangePi one使用Armbian更换国内源注意原来的文件要备份,换源有时会导致部分软件安装不上
1. 换中科大源
vim /etc/apt/sources.list

内容:
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-backports main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-proposed main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-security main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-updates main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-backports main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-proposed main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-security main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-updates main multiverse

sudo apt-get update

2. 换阿里源
vim /etc/apt/sources.list

deb https://mirrors.aliyun.com/raspbian/raspbian/ buster main non-free contrib
deb-src https://mirrors.aliyun.com/raspbian/raspbian/ buster main non-free contrib

vim /etc/apt/sources.list.d/raspi.list

deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui

sudo apt-get update
sudo apt-get upgrade
3. 问题处理:
Reading package lists... Done
W: GPG error: http://mirrors.ustc.edu.cn/debian stretch-updates InRelease: The following signatures couldnt be verified because the public key is not available: NO_PUBKEY ******* NO_PUBKEY *******
E: The repository http://mirrors.ustc.edu.cn/debian stretch-updates InRelease is not signed.

处理:
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 上面的*******

【树莓派学习 2. 开发环境搭建】


    推荐阅读