Title: How to install python3.6 on aws ec2 instance
Tags: python;python-3.x;amazon-web-services;docker;amazon-ec2
Question: This question is specifically for installing version 3.6 of python. Not any other versions.
I'm using aws' amazonlinux docker image and trying to install python3.6 on it. It worked less than a month ago simply using yum install python3.x86_64, but now it seems that all python3 versions are using python3.7 as shown below:
bash-4.2# sudo yum list | grep python3
python3.i686                           3.7.4-1.amzn2.0.3              amzn2-core
python3.x86_64                         3.7.4-1.amzn2.0.3              amzn2-core
python3-Cython.x86_64                  0.27.3-2.amzn2.0.2             amzn2-core
python3-debug.x86_64                   3.7.4-1.amzn2.0.3              amzn2-core
python3-devel.x86_64                   3.7.4-1.amzn2.0.3              amzn2-core
python3-libs.i686                      3.7.4-1.amzn2.0.3              amzn2-core
python3-libs.x86_64                    3.7.4-1.amzn2.0.3              amzn2-core
python3-lit.noarch                     0.7.1-1.amzn2.0.1              amzn2-core
python3-openmpi.x86_64                 4.0.1-11.amzn2.0.1             amzn2-core
python3-pip.noarch                     9.0.3-1.amzn2.0.1              amzn2-core
python3-rpm.x86_64                     4.11.3-40.amzn2.0.3            amzn2-core
python3-rpm-macros.noarch              3-23.amzn2                     amzn2-core
python3-setuptools.noarch              38.4.0-3.amzn2.0.6             amzn2-core
python3-test.x86_64                    3.7.4-1.amzn2.0.3              amzn2-core
python3-tkinter.x86_64                 3.7.4-1.amzn2.0.3              amzn2-core
python3-tools.x86_64                   3.7.4-1.amzn2.0.3              amzn2-core
python3-wheel.noarch                   0.30.0a0-9.amzn2.0.3           amzn2-core
Comment: @aws_apprentice I am using the same image I used a month ago and a month ago it still had python3.6 available

Comment: are you pulling the latest container? the older [tags](https://hub.docker.com/_/amazonlinux?tab=tags) probably have 3.6 installed on them

Here is the accepted answer: Please enable ius repository and install python36u
https://www.certdepot.net/rhel7-how-to-install-the-ius-community-repository/
yum install python36u
Comment for this answer: looks like python36 has been removed from epel and replaced by ius
Comment for this answer: Thanks AWS PS. But there is no package python36 in the epel list. Which one should I be installing?
Comment for this answer: IUS doesn't build packages for Amazon Linux.
https://ius.io/faq#is-ius-compatible-with-amazon-linux

Here is another answer: You can just download and build from source.
The steps are as follows:
Install gcc and sqlite-devel yum install gcc sqlite-devel
Extract the downloaded archive and cd to the directory
Configure with ./configure --enable-optimizations
And finally make altinstall.
altinstall avoid replacing the default /usr/bin/python.
That's it!
Comment for this answer: Thanks @sayan I might give that a try. Can't believe there's not a simpler solution to such a common problem...
Comment for this answer: Amazon official container uses Red Hat based distros. You cannot use apt-get.

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 2, 'CommentCount': 2, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2020:00:01/03/20', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<python><python-3.x><amazon-web-services><docker><amazon-ec2>', 'Title': 'How to install python3.6 on aws ec2 instance', 'ViewCount': 6085, 'id': 59582741, 'user_AboutMe': None, 'user_AccountId': 11457265.0, 'user_DisplayName': 'Ludo', 'user_Reputation': 2057.0, 'user_Views': 136.0, 'user_id': 8397886.0}}