解决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. EnableEurekaServer基本配置

    pom.xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId> ...

  2. 洛谷P2179 骑行川藏

    什么毒瘤... 解:n = 1的,发现就是一个二次函数,解出来一个v的取值范围,选最大的即可. n = 2的,猜测可以三分.于是先二分给第一段路多少能量,然后用上面的方法求第二段路的最短时间.注意剩余 ...

  3. pytest 15 fixture之autouse=True

    前言 平常写自动化用例会写一些前置的fixture操作,用例需要用到就直接传该函数的参数名称就行了.当用例很多的时候,每次都传这个参数,会比较麻烦.fixture里面有个参数autouse,默认是Fa ...

  4. UVA - 11427 Expect the Expected (概率dp)

    Some mathematical background. This problem asks you to compute the expected value of a random variab ...

  5. C#编程中的Image/Bitmap与base64的转换及 Base-64 字符数组或字符串的长度无效问题 解决

    最近用base64编码传图片遇到了点问题,总结下. 首先总结下base64编码的逻辑,来自网络:https://www.cnblogs.com/zhangchengye/p/5432276.html ...

  6. App测试的策略

    (一).App测试的策略 1.App测试需要考虑的方面     设备多样性     操作系统.浏览器.应用程序运行时环境.屏幕分辨率.人机交互界面和接口.人体工程学设计.屏幕尺寸等     运营商网络 ...

  7. 吐血记录微信小程序授权获取Unionid及linux下使用bouncycastle解密用户数据 遇到的坑

    背景 公司小程序上线了,发现系统无法拿到一些用户的UniondID.但是上线前的测试一切都是正常的. 坑1 经排查,发现一些用户通过下面的接口无法得到unionid https://api.weixi ...

  8. jenkins 自动化部署执行shell

    # -*- coding:utf-8 _*-""" @author:Administrator @file: new_app_publish.py @time: 2018 ...

  9. 将Python3导出为exe程序

    一.pyinstaller简介 Python是一个脚本语言,被解释器解释执行.它的发布方式: .py文件:对于开源项目或者源码没那么重要的,直接提供源码,需要使用者自行安装Python并且安装依赖的各 ...

  10. java基于redis事务的秒杀实现

    package com.vian.user.service; import org.junit.Test; import org.springframework.util.CollectionUtil ...