---
title: "【转载】ubuntu16.04安装python3.6"
id: "2443"
type: "post"
slug: "%e3%80%90%e8%bd%ac%e8%bd%bd%e3%80%91ubuntu16-04%e5%ae%89%e8%a3%85python3-6"
published_at: "2019-10-02T07:34:46+00:00"
modified_at: "2019-10-02T07:34:57+00:00"
url: "https://seq.ink/all/2443.html"
markdown_url: "https://seq.ink/all/2443.html.md"
excerpt: "原文 步骤1 sudo add-apt-repository ppa:jonathonf/python-3.6 步骤2 sudo apt-get update sudo apt-get install python3.6 步骤3 要pyth ..."
taxonomy_category:
  - "ALL"
---

[原文](http://ubuntuhandbook.org/index.php/2017/07/install-python-3-6-1-in-ubuntu-16-04-lts/)

步骤1

```
sudo add-apt-repository ppa:jonathonf/python-3.6
```

---

```
步骤2
```

```
sudo apt-get update

sudo apt-get install python3.6
```

---

```
步骤3
要python3使用新安装的python 3.6而不是默认的3.5版本，请运行以下2条命令
```

```
sudo update-alternatives --install / usr / bin / python3 python3 /usr/bin/python3.5 1 

sudo update-alternatives --install / usr / bin / python3 python3 /usr/bin/python3.6 2
```

最后，`python3`通过命令在两个python版本之间切换：

```
sudo update-alternatives --config python3
```

---

**更新：**由于此[错误](https://bugs.launchpad.net/ubuntu/+source/python3.6/+bug/1631367)
，gnome-terminal不会在步骤3之后启动，一种解决方法正在运行以下命令来重新创建符号链接：

```
sudo rm / usr / bin / python3 

sudo ln -s python3.5 / usr / bin / python3
```
