Ubuntu18更新软件源、安装python3.8和安装pip

2023-05-16

目录

      • 一、更新软件源
      • 二、安装python3.8
      • 三、安装pip

一、更新软件源

  • 1)首先,打开sources.list文件
    sudo vim /etc/apt/sources.list
    若没有vim,则需要进行安装。
    sudo apt-get install vim-gtk
  • 2)进入sources.list后,按i输入,在最后添加以下的国内源:

阿里源地址

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

华为源地址

deb https://repo.huaweicloud.com/ubuntu/ focal main restricted
deb https://repo.huaweicloud.com/ubuntu/ focal-updates main restricted
deb https://repo.huaweicloud.com/ubuntu/ focal universe
deb https://repo.huaweicloud.com/ubuntu/ focal-updates universe
deb https://repo.huaweicloud.com/ubuntu/ focal-backports main restricted universe
deb https://repo.huaweicloud.com/ubuntu/ focal-security main restricted
deb https://repo.huaweicloud.com/ubuntu/ focal-security universe

中科大源地址

deb http://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

清华源地址

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
  • 3)按Esc键,同时输入:wq后保存退出。

  • 4)输入命令更新系统软件源地址:
    sudo apt-get update

二、安装python3.8

在 Ubuntu 18.中,python3 的默认版本为 3.6

$ python3 -V
Python 3.6.9
  • 1)安装依赖包
$ sudo apt update
$ sudo apt install software-properties-common
  • 2)添加 deadsnakes PPA 源
$ sudo add-apt-repository ppa:deadsnakes/ppa
  • 3)安装 python 3.8
$ sudo apt install python3.8

$ python3.8 -V
  • 4)配置 python3.8 为系统默认 python3,将 python 各版本添加到 update-alternatives
$ which python3.8

/usr/bin/python3.8

$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1

$ which python3.6

/usr/bin/python3.6

$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2
  • 5)配置 python3 默认指向 python3.8
$ sudo update-alternatives --config python3

There are 2 choices for the alternative python3 (providing /usr/bin/python3).

Selection Path Priority Status

------------------------------------------------------------

* 0 /usr/bin/python3.6 2 auto mode

1 /usr/bin/python3.6 2 manual mode

2 /usr/bin/python3.8 1 manual mode

Press to keep the current choice[*], or type selection number: 2

选择/输入 2, 回车。

  • 6)测试 python 版本
$ python3 -V

Python 3.8.2

三、安装pip

$ sudo apt install python3-pip

如若出现以下错误
在这里插入图片描述
解决办法

sudo apt install gsettings-desktop-schemas

再安装

sudo apt-get install build-essential

然后,再次安装pip

$ sudo apt install python3-pip
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Ubuntu18更新软件源、安装python3.8和安装pip 的相关文章

随机推荐

  • NVIDIA Jetson Xavier NX搭建pytorch gpu环境(超详细)

    NVIDIA Jetson Xavier NX开发套件在搭建tensorflow gpu环境时可以使用指令直接安装或者官网下载whl文件安装 作者在安装pytorch环境时总是安装不上gpu版本 报错 AssertionError Torc
  • uCOS-iii学习笔记(11)——任务信号量和任务消息队列

    理解 xff1a 任务信号量 任务消息队列是跟随任务创建而来的 xff0c 不需要额外创建 xff0c 并且他和多值信号量 消息队列有一些不同 xff0c 多值信号量他们是建立于1对多得关系 xff0c 而我们的任务信号量还有任务消息队列是
  • C语言当中什么情况下形参可以改变实参详细实例及解释

    在 C 语言中 xff0c 形参可以改变实参的值的情况与 C 43 43 类似 xff0c 也有传递指针和传递引用两种方式 传递指针 当我们传递一个指针作为函数的形参时 xff0c 函数内部同样可以通过这个指针来改变指向的实参的值 这是因为
  • git仓库与vscode关联

    git仓库与vscode关联 git安装完后 xff0c 会提示输入用户信息 a 设置用户名 xff1a git config global user name 39 你再github上注册的用户名 39 b 设置用户邮箱 xff1a gi
  • python修改全局变量

    span class token comment 全局变量 span num span class token operator 61 span span class token number 10 span span class toke
  • python函数不能修改全局变量

    span class token comment 全局变量 span num span class token operator 61 span span class token number 10 span span class toke
  • FreeRTOS笔记(六)互斥量mutex

    概念 互斥量是二进制信号量的一个变种 xff0c 开启互斥量需要在头文件FreeRTOSConfig h 设置configUSE MUTEXES 为1 互斥量和信号量的主要区别如下 互斥量用于保护资源时必须要被返还 信号量用于数据同步时不需
  • 完爆面试官!spring可能带来的一个深坑

    4步套路 xff0c 解决动态规划问题 1 确定问题状态 提炼最后一步的问题转化 2 转移方程 xff0c 把问题方程化 3 按照实际逻辑设置初始条件和边界情况 4 确定计算顺序并求解 结合实例感受下 xff1a 你有三种硬币 xff0c
  • 树莓派Raspberry Pi 2B在Kali上使用TightVNCServer灰屏

    1 将 root vnc xstartup改为 span class token shebang important bin sh span unset SESSION MANAGER unset DBUS SESSION BUS ADDR
  • STM32——UCOSIII 简介

    目录 UCOSIII简介 UCOSIII中的任务 组成 任务堆栈 任务控制块 任务函数 任务函数模板 UCOSIII系统任务 组成 空闲任务 时钟节拍任务 统计任务 定时任务 中断服务管理任务 UCOSIII任务状态 组成及状态概念 UCO
  • ARM —— 寄存器的封装

    目录 SFR 直接一对一封装 结构体封装寄存器 SFR 全称 xff1a 特殊功能寄存器 xff08 Special Function Register xff09 作用 xff1a 用于 控制片内外设 xff0c 存放 相应功能部件的 控
  • Ubuntu给Pix2.4.8刷Ardupilot固件

    全文基于waf编译器使用 waf命令 xff0c APM官网对于waf的使用描述 xff1a https github com ArduPilot ardupilot blob master BUILD md 前提 xff1a 已经在ubu
  • 程序猿面试经验总结(经验篇)

    开篇序 金九银十大家都知道吧 xff0c 的确九十月份都是跳槽旺季与招聘旺季 xff0c 无论是找工作的 招聘的单位都是特别特别的多 xff0c 多的你有时候看都看不过来 xff0c 以至于让你有时候很难选择 xff0c 其实选择对应自己的
  • STM32 HAL库和标准库的原理区别

    STM32 HAL库和标准库的原理区别 HAL简介 HAL库 xff0c HAL是Hardware Abstraction Layer的缩写 xff0c 中文名称是 xff1a 硬件抽象层 xff0c 是st公司为了更方便地进行stm32之
  • 【超详细~】js的三大定时器:setTimeout、setInterval、requestAnimationFrame

    setTimeout xff08 表达式 xff0c 时间 xff09 61 gt 是指延迟指定时间后才调用函数 xff0c 调用次数仅一次 xff1b setInterval xff08 表达式 xff0c 时间 xff09 61 gt
  • FreeRTOS的学习(一)——实时操作系统和多任务的介绍

    目录 1 初识FreeRTOS 2 FreeRTOS 任务的状态 3 FreeRTOS 的任务 任务的创建和删除 1 xTaskCreate xff1a 使用静态的方法创建一个任务 2 xTaskCreateStatic xff1a 使用静
  • FreeRTOS的学习(四)—— 信号量之间的优先级翻转问题和互斥信号量

    目录 优先级翻转现象 什么是优先级翻转 互斥信号量 1 互斥信号量简介 2 创建互斥信号量 1 函数 xSemaphoreCreateMutex 2 函数 xSemaphoreCreateMutexStatic 3 释放互斥信号量 4 获取
  • STC15单片机 固定翼无人机/航模 飞控程序

    stc15单片机 固定翼无人机 飞控程序 硬件 stcf2k60s22 4g无线通信模块nrf24l01mg90s数字舵机摇杆无刷电机电调 用到的单片机资源 pwmad转换 程序结构 利用ADC转换读取摇杆值将摇杆数值转换为16进制通过2
  • ESP8266 WIFI 模块使用说明

    ESP8266是ai thinker公司推出的一款无线WIFI模块 xff0c 可以通过配置 xff0c 和单片机上的串口进行通信 xff0c 利用WIFI传输数据 1 AT指令简介 同许多通信模块一样 xff0c 我们需要对WIFI模块利
  • Ubuntu18更新软件源、安装python3.8和安装pip

    目录 一 更新软件源二 安装python3 8三 安装pip 一 更新软件源 1 xff09 首先 xff0c 打开sources list文件 sudo vim etc apt sources list 若没有vim xff0c 则需要进