加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

各种镜像源的更换

发布时间:2020-12-14 00:19:27 所属栏目:Linux 来源:网络整理
导读:各种镜像源的更换 树莓派 本次采用的是一块树莓派3B-PLUS的板子 树莓派的版本信息确定 查看树莓派的版本信息的几种方式: uname -a Linux raspberrypi 4.19 . 57 -v7+ # 1244 SMP Thu Jul 4 18 : 45 : 25 BST 2019 armv7l GNU/Linux lsb_release -a No LSB m

各种镜像源的更换

树莓派

本次采用的是一块树莓派3B-PLUS的板子

树莓派的版本信息确定

查看树莓派的版本信息的几种方式:

  • uname -a

    Linux raspberrypi 4.19.57-v7+ #1244 SMP Thu Jul 4 18:45:25 BST 2019 armv7l GNU/Linux
  • lsb_release -a

    No LSB modules are available.
    Distributor ID: Raspbian
    Description:    Raspbian GNU/Linux 10 (buster)
    Release:    10
    Codename:   buster
  • 使用软件查看:

    • 通过命令下载:sudo apt install screenfetch

    • 下载成功后,输入命令screenfetch,查看

        .,;:cc;,.    .,;::c:,.    [email?protected],ooolcloooo:  oooooccloo:    OS: Raspbian 10 buster
       .looooc;;:ol  :oc;;:ooooo    Kernel: armv7l Linux 4.19.57-v7+
         ;oooooo:,ooooooc.     Uptime: 11m
           .,:;.       .;:;.       Packages: 1446
           .... ..‘‘‘‘‘. ....        Shell: 858
         .‘‘.   ..‘‘‘‘‘.  ..‘‘.      DE: LXDE 
         ..  .....    .....  ..      WM: OpenBox
        .  .‘‘‘‘‘‘‘  .‘‘‘‘‘‘.  .     CPU: ARMv7 rev 4 (v7l) @ 1.4GHz
      .‘‘ .‘‘‘‘‘‘‘‘  .‘‘‘‘‘‘‘. ‘‘.   RAM: 183MiB / 874MiB
      ‘‘‘  ‘‘‘‘‘‘‘    .‘‘‘‘‘‘  ‘‘‘  
      .    ........... ...    ..  
        ....    ‘‘‘‘‘‘‘‘.   .‘‘.    
        ‘‘‘‘‘.  ‘‘‘‘‘‘‘‘. .‘‘‘‘‘    
         ‘‘‘‘‘.  .‘‘‘‘‘. .‘‘‘‘‘.    
          ..‘‘.     .    .‘‘..      
                .‘‘‘‘‘‘‘            
                 ......   

总结

从上述三种方式中,可以看出其操作系统为Raspbian 10 buster,有了这条信息,即可进行后续的换源操作。

换源

可参考清华站的使用帮助即可:https://mirrors.tuna.tsinghua.edu.cn/help/raspbian/

  • 进入上述网站;

  • 使用说明栏中选择之前查询的树莓派操作系统的版本,例如我的为Debian 10

    • 千万不要选错版本!

  • 编辑 /etc/apt/sources.list文件,将其中的内容修改为:

    deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib
    deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib

    将原先的内容用#+space注释掉即可

  • 再编辑/etc/apt/sources.list.d/raspi.list文件,将其中内容修改为:

    deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui
  • 编辑镜像站后,使用sudo apt-get update命令,更新软件源列表,同时检查方才的编辑是否正确。

Anaconda换源

参照清华站使用帮助:https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/

  • 找到用户目录下的 .condarc文件:

    • Windows 用户无法直接创建名为 .condarc 的文件,可在Anaconda Prompt中执行 conda config --set show_channel_urls yes 生成该文件之后再修改

  • 将其内容修改为:

    channels:
      - defaults
    show_channel_urls: true
    default_channels:
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
    custom_channels:  # 这部分内容有需要再添加即可,一般也不需要添加
      conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  • 若想恢复源,则通过输入命令:conda config --remove-key channels即可

PIP/PIP3的换源

  • 升级pip

    此处推荐将pip升级为pip3,采用命令为:python -m pip install --upgrade pip

参照清华站使用帮助:https://mirrors.tuna.tsinghua.edu.cn/help/pypi/

  • 临时使用,推荐

    • 命令为pip install -i https://pypi.tuna.tsinghua.edu.cn/simple 包的名字

  • 永久:

    • 升级 pip 到最新的版本 (>=10.0.0) 后进行配置:

    pip install pip -U
    pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
    • 如果您到 pip 默认源的网络连接较差,临时使用本镜像站来升级 pip:

    pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U

参考:

https://jingyan.baidu.com/album/ca00d56c144644e99febcf4d.html?picindex=3

https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/

https://mirrors.tuna.tsinghua.edu.cn/help/raspbian/

https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/

https://mirrors.tuna.tsinghua.edu.cn/help/pypi/

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读