Skip to content
On this page

对于python的不再被支持的过去发行版,会在相应的linux repo中删除掉,现在有几种方法安装。

Amazonlinux2 通过yum install python3默认安装是Python3.7。如果需要安装Python3.6的话,为您提供如下方法:

  1. 手动在EC2中添加支持添加python3.6的repo
  2. 安装anaconda/miniconda,然后新建python3.6的虚拟环境,您可以在anaconda找到更多信息。[^1][^2]
  3. 使用docker拉取一个python3.6的镜像 docker pull python:3.6 [^3]
  4. 编译python的源代码进行安装 [^4]

编译安装命令如下: Amazon linux 2的仓库里没有3.6版本的源,需要从官网下载源代码编译安装。

bash
sudo yum install -y gcc wget zib*
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz 
tar xJf Python-3.6.0.tar.xz
cd Python-3.6.0
sudo ./configure
sudo make
sudo make install

[^1]: Miniconda — conda documentation

[^2]: Anaconda | The World's Most Popular Data Science Platform

[^3]: python - Official Image | Docker Hub

[^4]: 2. Using Python on Unix platforms — Python 3.6.15 documentation

Released under the MIT License.