树莓派各种软件源修改

2021-11-03T21:10:00

修改 APT 镜像源

修改 Raspberry Pi OS 软件源

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

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

  • 32 位版本

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

    sudo nano /etc/apt/sources.list

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

    #deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
    # Uncomment line below then 'apt-get update' to enable 'apt-get source'
    #deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
    
    # use ustc mirror
    deb https://mirrors.sjtug.sjtu.edu.cn/raspbian/raspbian/ buster main contrib non-free rpi
  • 64 位版本

    对于 Raspberry Pi OS 64 位系统,直接使用 debian 软件源即可。

    编辑 sources.list 配置文件,注释掉官方的软件源,增加上海交通大学提供的镜像软件源

    #deb http://deb.debian.org/debian buster main contrib non-free
    #deb http://deb.debian.org/debian-security/ buster/updates main contrib non-free
    #deb http://deb.debian.org/debian buster-updates main contrib non-free
    # Uncomment deb-src lines below then 'apt-get update' to enable 'apt-get source'
    #deb-src http://deb.debian.org/debian buster main contrib non-free
    #deb-src http://deb.debian.org/debian-security/ buster/updates main contrib non-free
    #deb-src http://deb.debian.org/debian buster-updates main contrib non-free
    
    # use ustc mirror
    deb https://mirror.sjtu.edu.cn/debian buster main contrib non-free
    deb https://mirror.sjtu.edu.cn/debian-security/ buster/updates main contrib non-free
    deb https://mirror.sjtu.edu.cn/debian buster-updates main contrib non-free

修改 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
当前页面是本站的「Baidu MIP」版。发表评论请点击:完整版 »