0


Ubuntu下进行apt换源和pip换源

注:若要对两种源都进行更换的话,最好换成同一种源

一、主要的几种源

阿里云 [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/]

二、pip换源(以清华源为例)

1、进入到root目录下

sudo su

2、修改源

mkdir~/.pip
vim ~./pip/pip.conf

3、其整体的形式如下:

4、在文本编辑器中输入

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

注:其中index-url 中链接为一中几个源的链接

二、 apt换源(以清华源为例)

1、备份原先的官方源

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

2、修改源

**sudo gedit /etc/apt/sources.list **

3、在sources.list末尾(在我的修改中为:51~58)添加一下内容:

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse

**# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse **

**deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse **

**# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse **

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse

**# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse **

**deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse **

# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse

4、执行更新源命令 apt update

sudo apt update

注:apt下其他几种源

1、阿里源

**deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse **

**deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse **

**deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse **

**deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse **

deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse

2、中科大源

deb https://mirrors.ustc.edu.cn/ubuntu/ jammy main restricted universe multiverse

**deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy main restricted universe multiverse **

**deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse **

**deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse **

**deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse **

**deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse **

**deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-security main restricted universe multiverse **

**deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy-security main restricted universe multiverse **

**deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse **

**deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse **

3网易163源

deb http://mirrors.163.com/ubuntu/ jammy main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ jammy-security main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ jammy-updates main restricted universe multiverse

**deb http://mirrors.163.com/ubuntu/ jammy-proposed main restricted universe multiverse **

**deb http://mirrors.163.com/ubuntu/ jammy-backports main restricted universe multiverse **

deb-src http://mirrors.163.com/ubuntu/ jammy main restricted universe multiverse

**deb-src http://mirrors.163.com/ubuntu/ jammy-security main restricted universe multiverse **

**deb-src http://mirrors.163.com/ubuntu/ jammy-updates main restricted universe multiverse **

**deb-src http://mirrors.163.com/ubuntu/ jammy-proposed main restricted universe multiverse **

**deb-src http://mirrors.163.com/ubuntu/ jammy-backports main restricted universe multiverse **

标签: ubuntu pip linux

本文转载自: https://blog.csdn.net/qq_50206012/article/details/138168179
版权归原作者 水煮鱼12138 所有, 如有侵权,请联系我们删除。

“Ubuntu下进行apt换源和pip换源”的评论:

还没有评论