Ubuntu更换系统源与pip换源方法

1 更换ubutnu系统软件源

  • 首先备份ubuntu系统原来的源文件
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
  • 修改源
sudo vim /etc/apt/sources.list 
  • 选择一种源复制即可
# 阿里云源
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
 
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
 
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
 
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
 
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
 
 
# 清华大学源
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
 
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
 
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
 
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
 
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
  • 生效操作
sudo apt-get update

sudo apt-get upgrade

2 Ubuntu中python的pip更换源

  • 在家目录下创建.pip文件夹
mkdir ~/.pip 
  • 创建pip.conf文件
sudo vim ~/.pip/pip.conf
  • 3 将以下内容复制进pip.conf中
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
index-index-url = https://mirrors.aliyun.com/pypi/simple/ 
[install]
trusted-host =
    pypi.tuna.tsinghua.edu.cn
    mirrors.aliyun.com

补充

阿里云 [http://mirrors.aliyun.com/pypi/simple/]
 
中国科技大学 [https://pypi.mirrors.ustc.edu.cn/simple/]
 
豆瓣(douban) [http://pypi.douban.com/simple/]
 
清华大学 [https://pypi.tuna.tsinghua.edu.cn/simple/]
 
中国科学技术大学 [http://pypi.mirrors.ustc.edu.cn/simple/]
 
华中理工大学:[http://pypi.hustunique.com/]
 
山东理工大学:[http://pypi.sdutlinux.org/]

3 windows中更换pip源

  • 创建文件夹

win+R 打开用户目录%HOMEPATH%,在此目录下创建 pip 文件夹,在 pip 目录下创建 pip.ini 文件

  • 拷贝进以下内容
[global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn

参考1参考2

作者:Sunny_SunShine
欢迎任何形式的转载,但请务必注明出处。
限于本人水平,如果文章和代码有表述不当之处,还请不吝赐教。

posted @   Sunny_SunShine  阅读(836)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
历史上的今天:
2020-06-20 neo4j desktop下载及安装详解及CQL语法

喜欢请打赏

扫描二维码打赏

了解更多

点击右上角即可分享
微信分享提示