How to install Python 3 on Oracle Linux

You can install Python 3 on your Oracle Linux 7 environment with three simple steps:

  1. sudo yum install -y yum-utils
  2. sudo yum-config-manager --enable *EPEL
  3. sudo yum install -y python36

As a first step, in case you don’t have it yet on your system, is to install the yum-utils package. This package includes the yum-config-manager which allows you to easily enable and disable yum repositories, amongst other tasks.

[gerald@localhost ~]$ sudo yum install -y yum-utils
Loaded plugins: langpacks, ulninfo
Resolving Dependencies
--> Running transaction check
---> Package yum-utils.noarch 0:1.1.31-46.0.1.el7_5 will be updated
---> Package yum-utils.noarch 0:1.1.31-50.0.1.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================
Updating:
yum-utils noarch 1.1.31-50.0.1.el7 ol7_latest 121 k

Transaction Summary
=====================================================================================================================================
Upgrade 1 Package

Total download size: 121 k
Downloading packages:
No Presto metadata available for ol7_latest
yum-utils-1.1.31-50.0.1.el7.noarch.rpm | 121 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : yum-utils-1.1.31-50.0.1.el7.noarch 1/2
Cleanup : yum-utils-1.1.31-46.0.1.el7_5.noarch 2/2
Verifying : yum-utils-1.1.31-50.0.1.el7.noarch 1/2
Verifying : yum-utils-1.1.31-46.0.1.el7_5.noarch 2/2

Updated:
yum-utils.noarch 0:1.1.31-50.0.1.el7

Complete!
[gerald@localhost ~]$

Python 3 ships as part of the EPEL (Extra Packages for Enterprise Linux) repository but that repository is not enabled by default. With yum-config-manager enabling that repository is easy:


[gerald@localhost ~]$ sudo yum-config-manager --enable *EPEL
Loaded plugins: langpacks
===================================================== repo: ol7_developer_EPEL ======================================================
[ol7_developer_EPEL]
async = True
bandwidth = 0
base_persistdir = /var/lib/yum/repos/x86_64/7Server
baseurl = https://yum.oracle.com/repo/OracleLinux/OL7/developer_EPEL/x86_64/
cache = 0
cachedir = /var/cache/yum/x86_64/7Server/ol7_developer_EPEL
check_config_file_age = True
compare_providers_priority = 80
cost = 1000
deltarpm_metadata_percentage = 100
deltarpm_percentage =
enabled = 1
enablegroups = True
exclude =
failovermethod = priority
ftp_disable_epsv = False
gpgcadir = /var/lib/yum/repos/x86_64/7Server/ol7_developer_EPEL/gpgcadir
gpgcakey =
gpgcheck = True
gpgdir = /var/lib/yum/repos/x86_64/7Server/ol7_developer_EPEL/gpgdir
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
hdrdir = /var/cache/yum/x86_64/7Server/ol7_developer_EPEL/headers
http_caching = all
includepkgs =
ip_resolve =
keepalive = True
keepcache = False
mddownloadpolicy = sqlite
mdpolicy = group:small
mediaid =
metadata_expire = 21600
metadata_expire_filter = read-only:present
metalink =
minrate = 0
mirrorlist =
mirrorlist_expire = 86400
name = Oracle Linux 7Server Development Packages (x86_64)
old_base_cache_dir =
password =
persistdir = /var/lib/yum/repos/x86_64/7Server/ol7_developer_EPEL
pkgdir = /var/cache/yum/x86_64/7Server/ol7_developer_EPEL/packages
proxy = False
proxy_dict =
proxy_password =
proxy_username =
repo_gpgcheck = False
retries = 10
skip_if_unavailable = False
ssl_check_cert_permissions = True
sslcacert =
sslclientcert =
sslclientkey =
sslverify = True
throttle = 0
timeout = 30.0
ui_id = ol7_developer_EPEL/x86_64
ui_repoid_vars = releasever,
basearch
username =

[gerald@localhost ~]$

Now you are ready to install Python 3, version 3.6 in this case:


[gerald@localhost ~]$ sudo yum install -y python36
Loaded plugins: langpacks, ulninfo
ol7_UEKR4 | 1.2 kB 00:00:00
ol7_developer_EPEL | 1.2 kB 00:00:00
ol7_latest | 1.4 kB 00:00:00
(1/2): ol7_developer_EPEL/x86_64/updateinfo | 2.4 kB 00:00:00
(2/2): ol7_developer_EPEL/x86_64/primary | 8.0 MB 00:00:05
ol7_developer_EPEL 24145/24145
Resolving Dependencies
--> Running transaction check
---> Package python36.x86_64 0:3.6.6-1.el7 will be installed
--> Processing Dependency: python36-libs(x86-64) = 3.6.6-1.el7 for package: python36-3.6.6-1.el7.x86_64
--> Processing Dependency: libpython3.6m.so.1.0()(64bit) for package: python36-3.6.6-1.el7.x86_64
--> Running transaction check
---> Package python36-libs.x86_64 0:3.6.6-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================
Installing:
python36 x86_64 3.6.6-1.el7 ol7_developer_EPEL 65 k
Installing for dependencies:
python36-libs x86_64 3.6.6-1.el7 ol7_developer_EPEL 8.6 M

Transaction Summary
=====================================================================================================================================
Install 1 Package (+1 Dependent package)

Total download size: 8.6 M
Installed size: 36 M
Downloading packages:
(1/2): python36-3.6.6-1.el7.x86_64.rpm | 65 kB 00:00:00
(2/2): python36-libs-3.6.6-1.el7.x86_64.rpm | 8.6 MB 00:00:08
-------------------------------------------------------------------------------------------------------------------------------------
Total 1.0 MB/s | 8.6 MB 00:00:08
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : python36-3.6.6-1.el7.x86_64 1/2
Installing : python36-libs-3.6.6-1.el7.x86_64 2/2
Verifying : python36-libs-3.6.6-1.el7.x86_64 1/2
Verifying : python36-3.6.6-1.el7.x86_64 2/2

Installed:
python36.x86_64 0:3.6.6-1.el7

Dependency Installed:
python36-libs.x86_64 0:3.6.6-1.el7

Complete!
[gerald@localhost ~]$

You can verify the installation via python36 --version:

[gerald@localhost ~]$ python36 --version
Python 3.6.6
[gerald@localhost ~]$

Author: Gerald

Developer, Oracle expert, performance enthusiast and genuine technology geek.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.