解决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. ACM在线模板

    转载自:https://blog.csdn.net/f_zyj/article/details/51594851 Index 分类细则 说起分类准则,我也是很头疼,毕竟对于很多算法,他并不是单调的,而 ...

  2. Quick RF Tips for General Reference

    传送门:http://www.microwavetools.com/rf-tips-to-make-you-look-smart/ 全文搬运过来的,本篇文章并未有其它意义和目的,仅作为个人参考笔记,我 ...

  3. 利用反射将IDataReader读取到实体类中效率低下的解决办法

    最开始使用反射一个类型的各个属性,对气进行赋值的代码如下: public static List<T> ToList<T>(IDataReader reader) { //实例 ...

  4. (转)ReentrantLock实现原理及源码分析

    背景:ReetrantLock底层是基于AQS实现的(CAS+CHL),有公平和非公平两种区别. 这种底层机制,很有必要通过跟踪源码来进行分析. 参考 ReentrantLock实现原理及源码分析 源 ...

  5. Linux系统网络编程中TCP通讯socket--send导致进程被关闭

    https://blog.csdn.net/dsanmux/article/details/52083403 https://blog.csdn.net/u011425939/article/deta ...

  6. mysql You can't specify target table 'xxx' for update in FROM clause的解决

    DELETE from sp_goodscontent where goodsId in (SELECT t.goodsId from ( SELECT goodsId FROM sp_goodsco ...

  7. Redis的集群搭建

    一.集群的搭建 1.准备工作 (1)安装ruby环境 redis集群管理工具redis-trib.rb依赖ruby环境,首先需要安装ruby环境: yum -y install ruby yum -y ...

  8. 如何用ps简单快速扣头发丝

    好久不用PS抠图,今天接到一个小任务,换背景,以前一直用通道的办法,但用通道比较费劲,发现一个更简单的办法,就是用快速蒙版+调整边缘. 这张是原图: 1.先用快速蒙版制作选取(Q) 再按Q,退出快速蒙 ...

  9. 查看提交历史(git log)

    git log 命令 在完成了几次提交,或者克隆了一个已有提交历史的仓库后,要查看历史提交记录,可以通过git log命令来实现. $ git log commit 0becea8e1966df258 ...

  10. python3元组

    Python3 元组 元组运算符 len((1, 2, 3)) 3 计算元素个数 (1, 2, 3) + (4, 5, 6) (1, 2, 3, 4, 5, 6) 连接 ('Hi!',) * 4 (' ...