Python in AL2023 - Amazon Linux 2023
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Python in AL2023

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 of python that /usr/bin/python3 points to is considered the system Python and for AL2023 this is Python 3.9.

Newer versions of Python, such as Python 3.11, are made available as packages in AL2023 and are supported for the lifetime of the upstream versions. For information on how long Python 3.11 is supported, see Python 3.11.

Multiple versions of Python can be installed simultaneously on AL2023. Although /usr/bin/python3 will always be Python 3.9, each version of Python is namespaced and can be found by its version number. For example, if python3.11 is installed, then /usr/bin/python3.11 will exist alongside /usr/bin/python3.9 and the /usr/bin/python3 symlink to /usr/bin/python3.9.

Note

Do not change what the /usr/bin/python3 symlink points to because this might break the core functionality of AL2023.

Python modules in AL2023

Various Python modules are packaged as RPMs in AL2023. Typically, RPMs for Python modules will be built targeting only the system version of Python.