在树莓派上安装软件时候,经常遇到无法找到软件包或者下载速度过慢等情况,这时候我们需要更换软件源。

1.首先,打开/etc/apt/sources.list

sudo nano /etc/apt/sources.list

2.用#注释掉旧源(这里已经是清华源)

deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib$
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main con$
#deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-fre$

变成

#deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib$
#deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main con$
#deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-fre$