raspberrypi教程-更换国内源并升级系统

树莓派换源

以下内容可以在树莓派中访问此文章,继续查看。

bookworm内核系统换源

如果你的系统是bookworm内核的,按照如下方式换源。

可以参考如下视频。

参考网站:树莓派国内源网站,校园镜像联合站。

树莓派国内源网站,校园镜像联合站

如果不想参考视频,可以按照文章步骤进行,具体步骤如下:

换源步骤中使用的内容如下。

sudo nano /etc/apt/sources.list

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware


sudo nano /etc/apt/sources.list.d/raspi.list

deb https://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ bookworm main

sudo apt update

sudo apt upgrade

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/

打开树莓派的终端。

img

使用如下命令打开软件源配置文档。

sudo nano /etc/apt/sources.list

img

img

在打开的文件中,将所有行前无#符号的均添加此#符号,表示当前行不起作用。

img

复制如下内容重新粘贴进去。

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware

img

img

使用ctrl+X结束输入,使用Y键保存关闭,然后回车确认。

复制如下命令,打开存储另外一个软件源的文件。

sudo nano /etc/apt/sources.list.d/raspi.list

在打开的文件中,将所有行前无#符号的均添加此#符号,表示当前行不起作用。

img

复制如下内容到文档中。

deb https://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ bookworm main

img

使用ctrl+X结束输入,使用Y键保存关闭,然后回车确认。

更换python pip源

复制树莓派设置命令.txt文件中的如下命令并粘贴进去后回车确认,为树莓派将python源切换为国内清华源。

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/

示例:

img

更新树莓派系统

随后使用如下命令查看有哪些内容可以升级,并且可以看到软件源是否更新成功。

sudo apt update

img

img

使用sudo apt upgrade新换的源升级系统。

sudo apt upgrade

img

等待系统更新完成。

随后重启树莓派。

目录