森 • 时光机

树莓派各种软件源修改

修改 APT 镜像源

修改 Raspberry Pi OS 软件源

Raspberry Pi OS 是为树莓派设计,基于 Debian 的操作系统。

编辑/etc/apt/sources.list,将所有的deb与deb-src之后的网址替换成https://mirrors.sjtug.sjtu.edu.cn/raspbian/raspbian/

修改 raspberrypi 软件源

raspberrypi是树莓派基金会提供的软件源,包括 ui 相关程序及部分由树莓派基金会为树莓派编写的软件。

/etc/apt/sources.list.d/raspi.list 文件中的 http://archive.raspberrypi.org/debian/ 更换成 https://mirrors.sjtug.sjtu.edu.cn/raspberrypi/debian/

编辑 sources.list.d/raspi.list 配置文件,修改为上海交通大学提供的镜像

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

注释掉官方的软件源,并在下面增加 https://mirrors.sjtug.sjtu.edu.cn/raspberrypi/debian/ 软件源

#deb http://archive.raspberrypi.org/debian/ buster main
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspberrypi.org/debian/ buster main

# use ustc mirror
deb https://mirrors.sjtug.sjtu.edu.cn/raspberrypi/debian/ buster main

更新本地源

sudo apt update

更新 Python 软件源

更新 pypi 软件源

PyPI 是 Python 官方的包仓库,可以通过 pip, easy_install 等方式从 PyPI 安装 numpy, tensorflow 等常用包。

执行指令:

pip config set global.index-url https://mirror.sjtu.edu.cn/pypi/web/simple

或者创建或编辑 ~/.config/pip/pip.conf 文件,加入或修改 index-url 相关段落为:

[global]
index-url = https://mirror.sjtu.edu.cn/pypi/web/simple
format = columns

临时使用:

pip install -i https://mirror.sjtu.edu.cn/pypi/web/simple numpy

更新 piwheels 软件源

编辑 pip 配置文件,修改 piwheels 源:

sudo nano /etc/pip.conf

设置 extra-index-url 属性为 https://piwheels.wshon.com/simple ,并使用 # 注释掉原本的镜像源

[global]
#extra-index-url=https://www.piwheels.org/simple
extra-index-url=https://piwheels.wshon.com/simple

当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »