01_树莓派开发环境搭建
1. 树莓派简介
Raspberry Pi(中文名为“树莓派”), 是为学生计算机编程教育而设计,只有信用卡大小的微型电脑,其系统基于Linux。
2. 烧录系统
官网下载:https://www.raspberrypi.org/downloads/raspbian/
3.树莓派系统启动
开启SSH:sudo raspi-config
->Interfacing Options
-> SSH
4. 树莓派系统设置
sudo raspi-config
-> Localisation Options
5. 树莓派显示中文
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install ttf-wqy-zenhei
sudo raspi-config
->Localisation Options
->Change Locale
->zh_CN *
->sudo reboot
6. 固定树莓派IP
sudo nano /etc/dhcpcd.conf
# wifi连接 wlan0 网线连接 eth0
interface eth0
static ip_address=192.168.1.188/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 114.114.114.114
interface wlan0
static ip_address=192.168.1.188/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 114.114.114.114
sudo reboot
7. 连接Wi-Fi
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
network={
ssid="coco414"
psk="coco-414"
key_mgmt=WPA-PSK
}
8. 更换阿里源
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
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
sudo apt-get update
sudo apt-get upgrade
9.pip安装
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
pip -V
10.设置树莓派屏幕常亮,禁止树莓派屏幕休眠
sudo nano /etc/lightdm/lightdm.conf
# 找到[Seat:*]这一项,在下面的‘#xserver-command=X’删除前面的注释符#,修改为以下
xserver-command=X -s 0 -dpms
# 其中,-s 参数:设置屏幕保护不启动,0 数字零,-dpms 参数:关闭电源节能管理。
#保存退出:Ctrl+X,按Y 再按回车。
sudo reboot