wget https://www.python.org/ftp/python/3.4.2/Python-3.4.2.tgz
tar zxvf Python-3.4.2.tgz
cd Python-3.4.2
sudo yum install gcc
./configure --prefix=/opt/python3
make
sudo yum install openssl-devel
sudo make install
sudo ln -s /opt/python3/bin/python3 /usr/bin/python3
python3 (should start the interpreter if it's worked (quit() to exit)
sudo yum install python36 python36-devel python36-libs python36-tools
# If you like to have pip3.6:
curl -O https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py
正如@NickT 所说,在 Amazon Linux 2默认的 yum 回购协议中没有 python3[4-6] ,到目前为止它使用的是3.7,看看这里的所有答案,我们可以说它会随着时间的推移而改变。
我在 Amazon Linux 2上寻找 python3.6,但是 amazon-linux-extras显示了很多选项,但是根本没有 python。事实上,你可以尝试在 epel回购中找到你知道的版本:
sudo amazon-linux-extras install epel
yum search python | grep "^python3..x8"
python34.x86_64 : Version 3 of the Python programming language aka Python 3000
python36.x86_64 : Interpreter of the Python programming language