If you do a

Copysudo yum list | grep python3

you will see that while they don't have a "python3" package, they do have a "python34" package, or a more recent release, such as "python36". Installing it is as easy as:

Copysudo yum install python34 python34-pip
Answer from TaborKelly on Stack Overflow
Top answer
1 of 14
321

If you do a

Copysudo yum list | grep python3

you will see that while they don't have a "python3" package, they do have a "python34" package, or a more recent release, such as "python36". Installing it is as easy as:

Copysudo yum install python34 python34-pip
2 of 14
86

Note: This may be obsolete for current versions of Amazon Linux 2 since late 2018 (see comments), you can now directly install it via yum install python3.

In Amazon Linux 2, there isn't a python3[4-6] in the default yum repos, instead there's the Amazon Extras Library.

Copysudo amazon-linux-extras install python3

If you want to set up isolated virtual environments with it; using yum install'd virtualenv tools don't seem to reliably work.

Copyvirtualenv --python=python3 my_venv

Calling the venv module/tool is less finicky, and you could double check it's what you want/expect with python3 --version beforehand.

Copypython3 -m venv my_venv

Other things it can install (versions as of 18 Jan 18):

Copy[ec2-user@x ~]$ amazon-linux-extras list
  0  ansible2   disabled  [ =2.4.2 ]
  1  emacs   disabled  [ =25.3 ]
  2  memcached1.5   disabled  [ =1.5.1 ]
  3  nginx1.12   disabled  [ =1.12.2 ]
  4  postgresql9.6   disabled  [ =9.6.6 ]
  5  python3=latest  enabled  [ =3.6.2 ]
  6  redis4.0   disabled  [ =4.0.5 ]
  7  R3.4   disabled  [ =3.4.3 ]
  8  rust1   disabled  [ =1.22.1 ]
  9  vim   disabled  [ =8.0 ]
 10  golang1.9   disabled  [ =1.9.2 ]
 11  ruby2.4   disabled  [ =2.4.2 ]
 12  nano   disabled  [ =2.9.1 ]
 13  php7.2   disabled  [ =7.2.0 ]
 14  lamp-mariadb10.2-php7.2   disabled  [ =10.2.10_7.2.0 ]
🌐
AWS
docs.aws.amazon.com › amazon linux › user guide › getting started with programming runtimes › python in al2
Python in AL2 - Amazon Linux 2
AL2 provides support and security patches for Python 2.7 until June 2026, as part of our long-term support commitment for AL2 core packages. This support extends beyond the upstream Python community declaration of Python 2.7 EOL of January 2020.
Discussions

Amazon Linux 2 Python incompatibility woes
I didn’t have any issue with 3.9 and epel on al2. But I rarely use it. As someone else said pyenv or i generally take it a step further and just use docker since all of our stuff is already set up to easily run a container anywhere. I am generally so over touching python in the host os at all, or php, or really anything. Having to depend on their repos and all of that. No thanks. Take a few minutes and just forget what your host os is and containerize it where you will never again have those issues. I personally start with alpine but there are some good official and updated bases you can use to get you a full python environment on alpine in seconds. And customize anything else you need. That also makes sure if you ever change a host os that doesn’t have the same default modules installed you don’t even have to care. I would say forget packaging your software with rpm and go docker. Same concept. You publish a repo and version and all that. It just doesn’t have to care about the host os. At all (well, mostly ;)) More on reddit.com
🌐 r/aws
12
13
September 14, 2023
How do I install and use Python 3.8 on an Amazon EC2 Linux Instance? - Stack Overflow
All that being said, the default ... rid of 2.7 will cause problems. ... sudo rm /usr/bin/python (which is only a link to /usr/bin/python2.7) sudo ln -s /usr/bin/python3.8 /usr/bin/python · but usually peeps simply type python3.8 to specifically run the new version. ... Sign up to request clarification or add additional context in comments. ... Thanks!, the sudo amazon-linux-extras install ... More on stackoverflow.com
🌐 stackoverflow.com
Problem Building Python 3.7.0 in Amazon Linux 2
Maybe try pyenv . It builds any Python version for you. Before building make sure you have installed all build dependencies . Using pyenv-virtualenv you can activate the Python version for your virtual environment. More on reddit.com
🌐 r/aws
9
8
August 21, 2018
Updating Python 2 to Python 3 on Amazon Linux instance. Getting `No package available / Error: Nothing to do.`

Use amazon-linux-extras https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/amazon-linux-ami-basics.html#extras-library

More on reddit.com
🌐 r/linuxquestions
4
1
November 15, 2021
Top answer
1 of 2
3
Guess you are concerned that Python 3.7 EOL June this year If you want to avoid compiling and is fine with older version, python 3.8 is available from amazon-linux-extras You will need to remove python 3.7 first. Possible commands as below ``` # python3 --version Python 3.7.16 # sudo yum remove python3 # amazon-linux-extras | grep python 36 python3.8 available [ =stable ] # sudo amazon-linux-extras install python3.8 # rpm -ql python38 /usr/bin/pydoc3.8 /usr/bin/python3.8 /usr/share/doc/python38-3.8.16 /usr/share/doc/python38-3.8.16/README.rst /usr/share/man/man1/python3.8.1.gz # python3.8 --version Python 3.8.16 # sudo ln -s /usr/bin/python3.8 /usr/bin/python3 # sudo ln -s /usr/bin/pydoc3.8 /usr/bin/pydoc # python3 --version Python 3.8.16 ```
2 of 2
0
Hello, The latest stable version of Python available for Amazon Linux 2 AMI is 3.8 and you may install it using the amazon-linux-extras library. [+] Extras library (Amazon Linux 2) - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/amazon-linux-ami-basics.html#extras-library Regarding OpenSSL, Amazon Linux 2 comes with OpenSSL 1.0.2 by default. [+] https://docs.aws.amazon.com/linux/al2023/ug/compare-with-al2.html Any security concerns and CVE’s regarding OpenSSL could be found in the document below : https://alas.aws.amazon.com/alas2.html In order to apply the security updates for OpenSSL, you may run the “yum update openssl” command on the instance. Additionally, you may keep an eye on the documents below for information about the upcoming features and announcements to services in order to check for the availability of the latest versions of the above packages in Amazon Linux 2 : - What’s New - https://aws.amazon.com/new/ - AWS Blog - https://aws.amazon.com/blogs/aws/ Further, you may manually install the required Python version (Python 3.10) from the official Python download page and configure it on your instance. Please find below a third-party article that I hope would be helpful to you : https://techviewleo.com/how-to-install-python-on-amazon-linux-2/
🌐
GitHub
gist.github.com › Sunlighter › 87bbd2cd80971c7c0d4763ec1b5ea548
Installing Python 3.7 in Amazon Linux 2 - Gist - GitHub
Basically leverages altinstall. $ ./configure --enable-optimizations $ make altinstall ... $ which python3.7 /usr/local/bin/python3.7 $ which python /usr/bin/python $ python --version Python 2.7.14 ...
🌐
Reddit
reddit.com › r/aws › amazon linux 2 python incompatibility woes
r/aws on Reddit: Amazon Linux 2 Python incompatibility woes
September 14, 2023 -

A customer wants to continue to use Amazon Linux 2, I'm wanting to package some Python software for them, to be delivered via RPM.

Some dependencies are available in EPEL, and I used the Amazon instructions to install and enable that repo.

Using amazon-linux-extras installs Python 3.7, but nearly everything we need is in EPEL which is set for Python 3.6. So we insist on installing Python 3.6 from EPEL instead.

This makes we wonder how anyone is getting any work done with the Amazon Linux 2 image? Or am I doing something wrong? Is everyone just installing everything from source or using pip? The RPM packaging system appears in conflict with itself out of the box.

Top answer
1 of 5
54

Amazon has it's own Linux with extras, the command is:

    sudo amazon-linux-extras install python3.8

taken from https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install-linux.html but after installing 3.7 from there, there is the above update command appearing during the install telling how to upgrade. Ahh the convolution of hosted virtual machines, still easier than trying to get a console command line login on any other Linux on AWS.

It does rebuild the python to 3.8, cleaning up files from 3.7, so boom a clean build of 3.8 thanks to Amazon.

All that being said, the default "python" will still be 2.7 as there is no backward compatibility, and many think getting rid of 2.7 will cause problems.

So what NOT TO DO NEXT as we are done is:

    sudo rm /usr/bin/python  (which is only a link to /usr/bin/python2.7)
    sudo ln -s /usr/bin/python3.8 /usr/bin/python

but usually peeps simply type python3.8 to specifically run the new version.

2 of 5
6

These answers are now out of date as of Amazon Linux 2023. Amazon Linux 2023 FAQ

Q: Does AL2023 have Amazon-Linux-Extras like AL2?

A: No, AL2023 does not have extras. For higher-level software packages like language runtimes, we will use the quarterly release where we will add major/minor updates to packages as separate namespaced packages in addition to the default package provided in the repository. For example, default Python version in Amazon Linux 2023 may be 3.8, but we will add Python 3.9 (python39) as a separate namespaced package whenever it is made available. These additional packages will closely follow their upstream release cadence and support model and their support policies can be accessed by the package manager for compliance and security use cases. Default packages will continue to be supported throughout the life of AL2023.

Python is installed by default as python3 exact version is managed by Amazon. It is possible to pick a different version, but I have not found the instructions, since the currently install 3.9 works for my needs.

python3 --version
Python 3.9.16

python3x --version
always generated
-bash: python3x: command not found
regardless of choice of x

🌐
TecAdmin
tecadmin.net › how-to-install-python-3-11-on-amazon-linux-2
How to Install Python 3.11 on Amazon Linux 2 – TecAdmin
April 26, 2025 - Read: How to Use SSH to Connect Remote Linux Server · Next, download the Python 3.11 source code from the Python official website. At the time of writing, Python 3.11 is the latest version available.
🌐
DEV Community
dev.to › hkamran › installing-a-newer-version-of-python-on-amazon-ec2-1b4n
Installing a Newer Version of Python on Amazon EC2 - DEV Community
May 3, 2023 - The project required 3.11, so I needed to compile Python from source. I started by updating packages in YUM, the package manager for Amazon Linux 2, with sudo yum update.
Find elsewhere
🌐
GitHub
gist.github.com › PabTorre › 12f514f97688072d6a598f00707d4db4
Install Python 3.6 in Amazon Linux 2 · GitHub
April 5, 2020 - Install Python 3.6 in Amazon Linux 2. GitHub Gist: instantly share code, notes, and snippets.
🌐
H. Kamran
hkamran.com › articles › installing a newer version of python on amazon ec2
Installing a Newer Version of Python on Amazon EC2 | H. Kamran
May 3, 2023 - The project required 3.11, so I needed to compile Python from source. I started by updating packages in YUM, the package manager for Amazon Linux 2, with sudo yum update.
🌐
AWS
docs.aws.amazon.com › amazon linux › user guide › getting started with programming runtimes on al2023 › python in al2023
Python in AL2023 - Amazon Linux 2023
May 22, 2026 - AL2023 removed Python 2.7 and any components requiring Python are now written to work with Python 3. AL2023 makes Python 3 available as /usr/bin/python3 to retain compatibility with customer code, as well as Python code shipped with AL2023, this will remain as Python 3.9 for the life of AL2023. The version ...
🌐
TecAdmin
tecadmin.net › install-python-3-9-on-amazon-linux
How to Install Python 3.9 on Amazon Linux 2 – TecAdmin
April 26, 2025 - As you continue to work with Python, consider exploring its extensive ecosystem of libraries and frameworks, which can further enhance your programming capabilities and project efficiency. With Python 3.9 now installed on your Amazon Linux 2 system, you are well-prepared to tackle a wide variety ...
🌐
Amazon Web Services
aws.amazon.com › compute › amazon linux 2 › faqs
Amazon Linux 2 FAQs
2 weeks ago - The yumdownloader --source tool in Amazon Linux 2 provides source code access for many components. We will continue to provide critical security patches for Python 2 as per our LTS commitment for Amazon Linux 2 core packages even though the upstream Python community declared Python 2.7 End ...
🌐
CloudSpinx
cloudspinx.com › home › how to › how to install python 3.13 on amazon linux 2
How To Install Python 3.13 on Amazon Linux 2 - CloudSpinx
June 4, 2025 - Since we are going to install Python 3.13 on Amazon Linux 2 by building it from the source, the above dependencies are necessary. Check the installed version of GCC.
🌐
ComputingForGeeks
computingforgeeks.com › home › dev › how to install python 3.9 on amazon linux 2
How To Install Python 3.9 on Amazon Linux 2 | ComputingForGeeks
August 9, 2023 - A number of dependencies are required of building Python 3.9 on Amazon Linux 2 from source. Install them by running the following commands in the terminal · sudo yum -y groupinstall "Development Tools" sudo yum -y install openssl-devel bzip2-devel ...
🌐
Medium
medium.com › @phueb › installing-python-3-10-on-amazon-linux-2-dc2537ea9f4b
Installing Python 3.10 on Amazon Linux 2 | by Philip Huebner | Medium
January 2, 2024 - This tutorial guides you through the process of installing Python 3.10 on an Amazon Linux 2 instance. ... Python 3.10 requires OpenSSL 1.1; see PEP 644. But Amazon Linux is equipped with OpenSSL 1.0 instead.
🌐
GitHub
gist.github.com › niranjv › f80fc1f488afc49845e2ff3d5df7f83b
Install Python 3.6 in Amazon Linux · GitHub
FROM amazonlinux # The ... \ git \ yum-utils \ && yum clean all ... Here's an easy copy-paste install script for Python 3.6.12 on the default Amazon Linux 2 EC2 instance, based on the replies above....
🌐
Server Fault
serverfault.com › questions › 1099013 › how-to-set-python3-command-to-work-in-aws-linux-2
python - How to set python3 command to work in aws linux 2? - Server Fault
sudo yum install -y amazon-linux-extras amazon-linux-extras | grep -i python sudo amazon-linux-extras enable python3.8 sudo yum install python3.8 · After that, python3.8 command is working. [ec2-user@amazonlinux ~]$ python3.8 --version Python 3.8.5
🌐
Medium
computingpost.medium.com › how-to-install-python-3-10-on-amazon-linux-2-43ddcd511784
How To Install Python 3.10 on Amazon Linux 2 | by ComputingPost | Medium
October 23, 2022 - $ pip3.10 list Package Version ------------------ --------- certifi 2021.10.8 charset-normalizer 2.0.12 idna 3.3 klon 2.1.0 lxml 4.8.0 lxml-stubs 0.1.1 pip 22.0.4 requests 2.27.1 setuptools 58.1.0 urllib3 1.26.9 · A place where Python libraries, ...