linux:ubuntu:python3升级
差别
这里会显示出您选择的修订版和当前版本之间的差别。
| 两侧同时换到之前的修订记录前一修订版后一修订版 | 前一修订版 | ||
| linux:ubuntu:python3升级 [2026/10/13 22:06] – 外部编辑 127.0.0.1 | linux:ubuntu:python3升级 [2026/10/14 06:39] (当前版本) – 外部编辑 127.0.0.1 | ||
|---|---|---|---|
| 行 4: | 行 4: | ||
| 在 Ubuntu 16.04 中,python3 的默认版本为 Python 3.5.2 | 在 Ubuntu 16.04 中,python3 的默认版本为 Python 3.5.2 | ||
| - | 像类似'' | + | 像类似'' |
| 行 12: | 行 12: | ||
| ### - 安装依赖包 | ### - 安装依赖包 | ||
| - | < | + | |
| + | ``` | ||
| $ sudo apt update | $ sudo apt update | ||
| $ sudo apt install software-properties-common | $ sudo apt install software-properties-common | ||
| - | </ | + | ``` |
| ### - 添加源 | ### - 添加源 | ||
| - | < | + | |
| + | ``` | ||
| $ sudo add-apt-repository ppa: | $ sudo add-apt-repository ppa: | ||
| Press [ENTER] to continue or Ctrl-c to cancel adding it. | Press [ENTER] to continue or Ctrl-c to cancel adding it. | ||
| - | </ | + | ``` |
| ### - 安装python 3.6及以上 | ### - 安装python 3.6及以上 | ||
| - | < | + | |
| + | ``` | ||
| $ sudo apt install python3.8 | $ sudo apt install python3.8 | ||
| $ python3.8 -V | $ python3.8 -V | ||
| Python 3.8.2 | Python 3.8.2 | ||
| - | </ | + | ``` |
| ## - 配置 python3.8 为系统默认 python3 | ## - 配置 python3.8 为系统默认 python3 | ||
| ### - 将 python 各版本添加到 update-alternatives | ### - 将 python 各版本添加到 update-alternatives | ||
| - | < | + | |
| + | ``` | ||
| $ which python3.8 | $ which python3.8 | ||
| / | / | ||
| 行 47: | 行 54: | ||
| $ sudo update-alternatives --install / | $ sudo update-alternatives --install / | ||
| - | </ | + | ``` |
| ### - 配置 python3 默认指向 python3.8 | ### - 配置 python3 默认指向 python3.8 | ||
| - | < | + | |
| + | ``` | ||
| $ sudo update-alternatives --config python3 | $ sudo update-alternatives --config python3 | ||
| 行 62: | 行 71: | ||
| Press < | Press < | ||
| - | </ | + | ``` |
| ### - 测试 python 版本 | ### - 测试 python 版本 | ||
| - | < | + | |
| + | ``` | ||
| $ python3 -V | $ python3 -V | ||
| Python 3.8.2 | Python 3.8.2 | ||
| - | </ | + | ``` |
linux/ubuntu/python3升级.1791900372.txt.gz · 最后更改: 由 127.0.0.1
