各种镜像源的更换

各种镜像源的更换

树莓派

本次采用的是一块树莓派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/

原文地址:https://www.cnblogs.com/zhuchengchao/p/11622065.html

时间: 2024-08-30 09:47:48

各种镜像源的更换的相关文章

为你的pip更换一个国内的镜像源

为你的pip更换一个国内的镜像源 是否常常为pypi官网被无故和谐掉导致pip不能下载python的各个包而痛心疾首? 是否常常在深夜里看着pip install 下载包的速度慢如乌龟而长吁短叹? 是否常常下载wheel文件到本地手动安装只为了不在自动安装的下载中途断开连接? 是时候更换一个国内的镜像源了!(祝病魔早日战胜方校长) 国内pypi镜像 V2EX:http://pypi.v2ex.com/simple 豆瓣:http://pypi.douban.com/simple 中国科学技术大学

Composer 更换为国内镜像源(Packagist 镜像)

以 laravel 项目的 composer.json 配置文件为例,添加本镜像服务配置信息后如下所示(注意红色代码): { "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true, "secure-http": false }, "repositor

树霉派更换软件镜像源

由于某些原因,国内访问树霉派官网的速度比较慢,所以我们有必要更换国内镜像源 1.备份源文件 sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak sudo cp /etc/apt/sources.list.d/raspi.list /etc/apt/sources.list.d/raspi.list.bak 2.修改软件更新源 sudo nano /etc/apt/sources.list # 将第一行修改成中科大的软件源地址,「Ctrl

windows环境下 更换pip镜像源

windows  环境下 更换pip镜像(从国外源更新为国内源) 第一步: 在C:\Users\Administrator 目录下 创建pip文件 第二步: 在第一步创建的文件夹下创建pip.ini文件 第三步:pip.ini文件内容(国内常用镜像源见文末附录) [global]index-url = http://mirrors.aliyun.com/pypi/simple/[install]trusted-host = mirrors.aliyun.com 第四步:保存后测试-成功 pip

树莓派更换国内镜像源

网上常见的教程往往都是替换软件更新源(/etc/apt/sources.list),实际上还存在一个系统更新源(/etc/apt/sources.d/raspi.list).我们对这两个文件进行修改,将其中的源网址更换为国内镜像站点即可. 步骤一.备份原文件 sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak sudo cp /etc/apt/sources.list.d/raspi.list /etc/apt/sources.list

树莓派2、3更换镜像源

树莓派系统安装后默认使用国外的镜像源,因为墙的原因,所以在安装模块的时候速度非常慢,因此需要将镜像源换成国内的. 1.打开配置sources.list文件 sudo nano /etc/apt/sources.list 2.用#注释掉原文件内容,用以下内容取代(Ctrl + O 保存再 Ctrl + X 退出): deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi

ubuntu16.04更换镜像源

1.备份原有 cp /etc/apt/sources.list /etc/apt/sources.list.old 2.打开阿里巴巴镜像源:  https://opsx.alibaba.com/mirror,打开帮助找到 ubuntu 16.04 配置如下 deb http://mirrors.aliyun.com/ubuntu/ xenial main deb-src http://mirrors.aliyun.com/ubuntu/ xenial main deb http://mirror

Python更换镜像源

目录 Windows Mac 这篇文章将解除你使用python的pip install xxx受到的网速限制,如果只是下载较小的第三方库,可以尝试pip --default-timeout=100 install -U xxx. Windows 找到python安装目录下的:\Lib\site-packages\pip\models\index.py文件,将PYPI的值改为你所需要的镜像源即可,例如改为豆瓣镜像源: #PyPI = Index('https://pypi.python.org/'

npm更换成淘宝镜像源以及cnpm

1.需求由来 由于node安装插件是从国外服务器下载,受网络影响大,速度慢且可能出现异常.所以如果npm的服务器在中国就好了,所以我们乐于分享的淘宝团队(阿里巴巴旗下业务阿里云)干了这事.来自官网:“这是一个完整 npmjs.org 镜像,你可以用此代替官方版本(只读),同步频率目前为 10分钟 一次以保证尽量与官方服务同步. 也就是说我们可以使用阿里布置在国内的服务器来进行node安装. 2.使用方法 1.使用阿里定制的 cnpm 命令行工具代替默认的 npm,输入下面代码进行安装: $ np