解决ubuntu的pip和apt-get太慢的问题

ubuntu国外龟速的源实在难受,还是自己动手更改一下各种pip 源和apt-get 的源吧,换了之后速度令人舒适!

  1. 更换pip源成清华源

    • 临时使用:

      可以在使用pip的时候加参数-i https://pypi.tuna.tsinghua.edu.cn/simple例如

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

      这样就从清华这边的镜像去安装opencv-python

    • 永久修改

      • linux下,修改 ~/.pip/pip.conf (没有就创建一个), 修改 index-url至清华源,内容如下:

        [global]
        index-url = https://pypi.tuna.tsinghua.edu.cn/simple
      • windows下,找到 C:\Users\xxx(自己名字)\AppData\Roaming\pip,新建文件pip.ini,内容如下

        [global]
        index-url = https://pypi.tuna.tsinghua.edu.cn/simple
  2. 更换apt-get成清华源

    • 原文件备份(万一更换的源不行的时候,复制回来)

      sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
    • 编辑源列表文件

      sudo vim /etc/apt/sources.list
    • 将原来的列表删除,添加清华镜像源(https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/)

      # 默认注释了源码镜像以提高 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 multiverse
      deb 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 multiverse
      deb 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 multiverse
      deb 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
    • sudo apt-get update 让更改生效

  3. 更换conda install源成清华源

    • 编辑源列表文件

      gedit ~/.condarc
    • 删除文件内容,替换默认源成清华源

      channels:
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
      - defaults
      show_channel_urls: yes

ubuntu更换pip install,apt-get,conda install 成国内源的更多相关文章

  1. ubuntu更换pip源

    1.创建pip.conf文件 cd ~/.pip 当提示不存在时,创建它 mkdir ~/.pip 在.pip目录下创建一个pip.conf文件 touch pip.conf 2.编辑pip.conf ...

  2. 【转载】 180623 Conda install 本地压缩包文件tar.bz2

    原文地址“ https://blog.csdn.net/qq_33039859/article/details/80785535 ----------------------------------- ...

  3. conda、pip换源以及conda、pip命令比较

    conda换源: conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda ...

  4. sudo apt-get install 、 pip install和conda install的对比

    sudo apt-get install: apt-get可以用来安装软件.更新源,也可以用来更新自Ubuntu的典型依赖包. (sudo apt-get remove --purge 软件名称 su ...

  5. conda install和pip install区别

    conda ≈ pip(python包管理) + virtualenv(虚拟环境) + 非python依赖包管理 级别不一样conda和yum比较类似,可以安装很多库,不限于Python.conda是 ...

  6. ubuntu 装tensorflow出现 conda install ERROR missing write permission错误

    通过搜索tensorflow然后运行,例如:$ conda install --channel https://conda.anaconda.org/jjh_cio_testing tensorflo ...

  7. ubuntu conda install ERROR missing write permission错误

    报错: ondaIOError: Missing write permissions in: /usr/local/anaconda3 # # You don't appear to have the ...

  8. conda install 出错

    在下载包时出现下面的错误: userdeMBP:pytorch user$ conda install -n deeplearning matplotlib Solving environment: ...

  9. Ubuntu无法安装rpm包,ubuntu RPM should not be used directly install RPM packages, use Alien instead!

    Ubuntu无法安装rpm包,ubuntu RPM should not be used directly install RPM packages, use Alien instead! 简单来说, ...

随机推荐

  1. bzoj3678 Katu Puzzle

    题目链接 题意 给定一张图,对于每条边给出一个运算符\((\&,|,\otimes)\)和一个值\(c(0 \le c \le 1)\).问能否通过给每个点赋上一个值.使得每条边通过指定的运算 ...

  2. 公共DNS推荐及dns测速

    DNS在平时上网中扮演重要角色,如果不注意DNS的话,可能会导致网速慢.弹窗广告.网址打不开.打开不是自己想要的网站.劫持等一系列问题.针对DNS的问题,今天我们就来总结一下,看看哪个DNS服务器最好 ...

  3. (双指针 二分) leetcode 167. Two Sum II - Input array is sorted

    Given an array of integers that is already sorted in ascending order, find two numbers such that the ...

  4. Linux中errno的含义

    /****************************获取错误代码描述**************/ #include <string.h>#include <errno.h&g ...

  5. 关于APP测试的一点思考

    1  系统入口部分要细化测试用例颗粒度  充分准备好测试数据   真实覆盖线上场景 比如注册验证码的获取  国内 国外手机  一般国外手机发送短信 打电话都要加上区号 2 新版本发布   有新功能上线 ...

  6. 第一节:EF Core简介和CodeFirst和DBFirst两种映射模式(以SQLite和SQLServer为例)

    一. EF简介 1. 定义 Entity Framework (EF) Core 是轻量化.可扩展.开源和跨平台的数据访问技术,它还是一种对象关系映射器(ORM),它使.NET 开发人员能够使用面向对 ...

  7. Arduino语法-变量和常量

    变量的声明: int led=11 一般变量的声明方法为类型名+变量名+变量初始化值.变量名的写法约定为首字母小写 变量的作用范围又称为作用域,变量的作用范围与该变量在哪儿声明有关,大致分为如下两种: ...

  8. P2P互联网金融企业的四大转型方向

    1.按照国标做成百分百的信息中介平台.这个定位太低,无利可图,如果政策导向真按着这个路径走,未来可能只剩下不到50家平台; 2.转型成为带“民营银行”属性的平台.这还得国家网开一面,学习英国模式,允许 ...

  9. will not be managed by Spring/ [managed: 15; max: 15]

    检查事务配置 检查 mybatis 配置文件扫描路径是否正确 <!-- 自动扫描 --> <context:component-scan base-package="com ...

  10. MySql 从SQL文件导入

    1. 运行cmd进入命令模式,进入Mysql安装目录下的bin目录(即mysql.exe所在的目录): cd c:\"program Files"\MySQL\"MySQ ...