将 Ubuntu 16 和 18 上的 python 升级到最新 python3.8 的方法教程
1.概述
本文记录在Ubuntu16.04上将python升级为3.8版本,并配置为系统默认python3的过程。
在Ubuntu16.04中,python3的默认版本为3.5:
$python3-V
Python3.5.2
本文以在Ubuntu16.04中安装为例,方法同样适用于Ubuntu18.04。
2.通过Apt安装
Ubuntu官方apt库中还未收录python3.8,这里使用 deadsnakesPPA库安装。
2.1.安装依赖包
$sudoaptupdate $sudoaptinstallsoftware-properties-common
2.2.添加deadsnakesPPA源
$sudoadd-apt-repositoryppa:deadsnakes/ppa
Press[ENTER]tocontinueorCtrl-ctocanceladdingit.
2.3.安装python3.8
$sudoaptinstallpython3.8
$python3.8-V
Python3.8.2
3.配置python3.8为系统默认python3
3.1.将python各版本添加到update-alternatives
$whichpython3.8 /usr/bin/python3.8 $sudoupdate-alternatives--install/usr/bin/python3python3/usr/bin/python3.81 $whichpython3.5 /usr/bin/python3.5 $sudoupdate-alternatives--install/usr/bin/python3python3/usr/bin/python3.52
3.2.配置python3默认指向python3.8
$sudoupdate-alternatives--configpython3 Thereare2choicesforthealternativepython3(providing/usr/bin/python3). SelectionPathPriorityStatus ------------------------------------------------------------ *0/usr/bin/python3.52automode 1/usr/bin/python3.52manualmode 2/usr/bin/python3.81manualmode Presstokeepthecurrentchoice[*],ortypeselectionnumber:2
选择/输入2,回车。
3.3测试python版本
$python3-V
Python3.8.2
资源
HowtoInstallPython3.8onUbuntu18.04
Howtoupgradetopython3.7onUbuntu18.10
总结
到此这篇关于将Ubuntu16和18上的python升级到最新python3.8的方法教程的文章就介绍到这了,更多相关Ubuntu16和18升级到python3.8内容请搜索毛票票以前的文章或继续浏览下面的相关文章希望大家以后多多支持毛票票!
声明:本文内容来源于网络,版权归原作者所有,内容由互联网用户自发贡献自行上传,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任。如果您发现有涉嫌版权的内容,欢迎发送邮件至:czq8825#qq.com(发邮件时,请将#更换为@)进行举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。