首页 > 编程知识 正文

ubuntu下更换pip镜像源,ubuntu 安装pip命令

时间:2023-05-03 11:14:57 阅读:245043 作者:251

我们在安装软件及安装各种包过程中,pip install xxxx, sudo apt-get install xxxx
有时候会发现非常的慢,这是因为我们没有更新源

pip 源的更新

在家目录下创建.pip目录

sudo mkdir .pip

然后创建pip.conf文件

sudo touch .pip/pip.confsudo vim .pip/pip.conf

添加下面两行:

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

保存退出即可

apt-get源的更新

即更改ubuntu镜像源

在百度搜索–>ubuntu镜像站–>选择清华的镜像源–>进去选择ubuntu—>选择ubuntu的版本(这里以16.04的为例)–>复制里面的内容:(内容如下,不过一直在更新,我们可以安装上面的步骤去搜索即可)
在这里插入图片描述

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse# 预发布软件源,不建议启用# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse

进入/etc/apt目录下

cd /etc/apt

修改sources.list文件,(当然为安全起见可以先把文件备份一份)

sudo vim sources.list

把刚才复制的内容覆盖原有的内容,保存退出即可

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。