注意,Ubuntu16.04默认安装了Python2.7和3.5,系统自带的python千万不可卸载!
1、python3.6安装命令
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6
2、sudo apt-get update步骤出错
执行sudo apt-get update可能会失败,尝试了多种解决办法,最终通过更换清华源解决问题:
- 先备份sources.list :
Step 1: cd /etc/apt/
Step 2: sudo cp sources.list sources.list.bak - 编辑sources.list:
Step 1: sudo gedit /etc/apt/sources.list(注:使用sudo vim /etc/apt/sources.list无法编辑,会提示只读文件)
Step 2: 将sources.list更换为清华源:
# 默认注释了源码镜像以提高 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 ma