Ubuntu 命令行更改源

在修改source.list前,最好先备份一份

软件源的地址配置文件在 /etc/apt/sources.list

执行备份命令

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

执行命令打开source.list文件:

可以用vim,gedit,atom等工具打开

sudo vim /etc/apt/sources.list

内容如下

# deb cdrom:[Ubuntu 18.04.3 LTS _Bionic Beaver_ - Release amd64 (20190805)]/ bionic main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic main restricted ## Major bug fix updates produced after the final release of the
## distribution.
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu/ bionic universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic universe
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://mirrors.aliyun.com/ubuntu/ bionic multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse ## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse ## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted
# deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://mirrors.aliyun.com/ubuntu/ bionic-security universe
# deb-src http://security.ubuntu.com/ubuntu bionic-security universe
deb http://mirrors.aliyun.com/ubuntu/ bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse

pip 源的配置

Win 下, %HOMEPATH%, pip/pip.ini

Ubuntu 下, ~/.pip/pip.conf

内容如下

[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = mirrors.aliyun.com

虚拟环境配置

环境:

  • Ubuntu 18.04
  • Python3
如果系统同时安装了python2和3版本,请执行下面的命令

pip2 install virtualenv

pip2 install virtualenvwrapper

pip3 install virtualenv

pip3 install virtualenvwrapper

# Win
pip install virtualenvwrapper-win

使用pip3安装virtualenvvirtualenvwrapper两个包,ubuntu18.04中,用户使用pip安装的包在~/.local/下,在.bashrc中添加的配置如下:

# Python Virtualenv Settings

export WORKON_HOME=~/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
source ~/.local/bin/virtualenvwrapper.sh

使用mkvirtualenv创建虚拟环境时,报错如下:

roc@roc-ThinkPad-E455:~$ mkvirtualenv remote
ERROR: virtualenvwrapper could not find virtualenv in your path

提示virtualenv 不在环境中,需要在配置文件添加virtualenv的路径进去,具体配置如下:

# Python Virtualenv Settings

export WORKON_HOME=~/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
# 指定virtualenv的路径
export VIRTUALENVWRAPPER_VIRTUALENV=~/.local/bin/virtualenv
source ~/.local/bin/virtualenvwrapper.sh

然后重新加载.bashrc文件即可

Ubuntu源、Python虚拟环境及pip源配置的更多相关文章

  1. python虚拟环境 + 批量pip + 换源

    python虚拟环境 + 批量pip + 换源 虚拟环境 曾经我是一个小白,不管运行什么项目都用一个环境,后来项目多了,有的是Django1.11的有的是Django2的,有的项目只能在3.6上运行, ...

  2. Python虚拟环境的安装和配置-virtualenv与windows下多个python版本共存

    Python虚拟环境的安装和配置-virtualenv与windows下多个python版本共存 windows下多个python版本共存 https://www.python.org/downloa ...

  3. python:更改pip源

    windows更改pip源 cmd echo %APPDATA% 打开目录 创建文件夹pip 创建pip.ini文件 [global] timeout = 60 index-url = http:// ...

  4. Python入门 更换pip源的方法

    pip国内的一些镜像 阿里云 http://mirrors.aliyun.com/pypi/simple/ 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple ...

  5. Python 更换国内pip源

    pip国内的一些镜像: 阿里云 http://mirrors.aliyun.com/pypi/simple/   中国科技大学 https://pypi.mirrors.ustc.edu.cn/sim ...

  6. python为何需要虚拟环境--Python虚拟环境的安装和配置-virtualenv

    一 虚拟环境 virtual environment 它是一个虚拟化,从电脑独立开辟出来的环境.通俗的来讲,虚拟环境就是借助虚拟机docker来把一部分内容独立出来,我们把这部分独立出来的东西称作“容 ...

  7. mac 下 python 虚拟环境的安装和配置

    前言:继续安装中,这节记录 mac 安装 python 虚拟环境,多版本共存... 1. 安装 pip -- python的包管理工具: sudo easy_install pip 安装成功,出现下面 ...

  8. Python虚拟环境中pip install时没有权限问题

    virtualenv Permission denied 新建的python虚拟环境的目录的所属者必须是当前用户,才不会出现这种错误 比如 virtualenv py27 sudo chown zzf ...

  9. PYTHON指定国内PIP源

    一.LINUX: vi ~/.pip/pip.conf 输入内容: [global]index-url = http://pypi.douban.com/simple/[install]trusted ...

随机推荐

  1. ECharts的下载和安装(图文详解)

    首先搜索找到ECharts官网,点击进入. 找到下载 进入就看到第三步,就点击在线制作 点击进入之后就自己可以选择里面的形状图,就在线制作.最后生成echarts.min.js 点击下载后就会生成js ...

  2. babel 与 ast

    什么是 babel Babel 是一个工具链,主要用于将 ECMAScript 2015+ 版本的代码转换为向后兼容的 JavaScript 语法,以便能够运行在当前和旧版本的浏览器或其他环境中. 什 ...

  3. SpringBoot从入门到精通教程(二)

    SpringBoot 是为了简化 Spring 应用的创建.运行.调试.部署等一系列问题而诞生的产物,自动装配的特性让我们可以更好的关注业务本身而不是外部的XML配置,我们只需遵循规范,引入相关的依赖 ...

  4. 第一天——编程语言与python

    ------------恢复内容开始------------ what's the python? python是一门编程语言,编程语言就是人用来和计算机沟通的语言,语言就是人与人,人与事物进行沟通的 ...

  5. rocketMq broker.conf全部参数解释

    #4.7.1版本 #所属集群名字brokerClusterName=rocketmq-cluster#broker名字,名字可重复,为了管理,每个master起一个名字,他的slave同他,eg:Am ...

  6. Java 面向对象概述

    本文部分摘自 On Java 8 面向对象编程 在提及面向对象时,不得不提到另一个概念:抽象.编程的最终目的是为了解决某个问题,问题的复杂度直接取决于抽象的类型和质量.早期的汇编语言通过对底层机器作轻 ...

  7. 【mybatis-plus】主键id生成、字段自动填充

    一.主键id的生成 数据库表里通常都会有一个主键id,来作为这条数据的唯一标识. 常见的方式 数据库自动增长 这种很常见了,可以做到全库唯一.因为id是天然排序的,对于涉及到排序的操作会很方便. UU ...

  8. Dubbo SPI源码解析①

    目录 0.Java SPI示例 1.Dubbo SPI示例 2.Dubbo SPI源码分析 ​ SPI英文全称为Service Provider Interface.它的作用就是将接口实现类的全限定名 ...

  9. Impala的count(distinct QUESTION_ID) 与ndv(QUESTION_ID)

    在impala中,一个select执行多个count(distinct col)会报错,举例: select C_DEPT2, count(distinct QUESTION_BUSI_ID) as ...

  10. flowable的多人会签和一票否决

    项目结构: 接下来代码: Duorenhuiqian.bpmn20.xml: <?xml version="1.0" encoding="UTF-8"?& ...