How to install Python 3 on Oracle Linux

Oracle Linux 7 doesn’t come with Python 3 by default but only with Python 2. Luckily, installing Python 3 can be done with two simple steps:

  1. sudo yum install -y oracle-epel-release-el7
  2. sudo yum install -y python36

The first step installs and enables the Oracle EPEL yum repository (EPEL – Extra Packages for Enterprise Linux) which includes the Python 3.6 version. In case the repository is already installed, yum will detect that and do nothing. So nothing will go wrong if you execute the command unnecessarily or twice.

[gerald@localhost ~]$ sudo yum install -y oracle-epel-release-el7
Loaded plugins: ulninfo
ol7_UEKR5 | 2.5 kB 00:00:00
ol7_latest | 2.7 kB 00:00:00
(1/5): ol7_UEKR5/x86_64/updateinfo | 33 kB 00:00:00
(2/5): ol7_latest/x86_64/group | 810 kB 00:00:00
(3/5): ol7_latest/x86_64/updateinfo | 918 kB 00:00:00
(4/5): ol7_UEKR5/x86_64/primary_db | 3.9 MB 00:00:01
(5/5): ol7_latest/x86_64/primary_db | 16 MB 00:00:02
Resolving Dependencies
--> Running transaction check
---> Package oracle-epel-release-el7.x86_64 0:1.0-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================================================
Package Arch Version Repository Size
=======================================================================================================================================
Installing:
oracle-epel-release-el7 x86_64 1.0-2.el7 ol7_latest 14 k

Transaction Summary
=======================================================================================================================================
Install 1 Package

Total download size: 14 k
Installed size: 18 k
Downloading packages:
oracle-epel-release-el7-1.0-2.el7.x86_64.rpm | 14 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : oracle-epel-release-el7-1.0-2.el7.x86_64 1/1
Verifying : oracle-epel-release-el7-1.0-2.el7.x86_64 1/1

Installed:
oracle-epel-release-el7.x86_64 0:1.0-2.el7

Complete!
[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: ulninfo
Resolving Dependencies
--> Running transaction check
---> Package python36.x86_64 0:3.6.8-1.el7 will be installed
--> Processing Dependency: python36-libs(x86-64) = 3.6.8-1.el7 for package: python36-3.6.8-1.el7.x86_64
--> Processing Dependency: libpython3.6m.so.1.0()(64bit) for package: python36-3.6.8-1.el7.x86_64
--> Running transaction check
---> Package python36-libs.x86_64 0:3.6.8-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================================================
Package Arch Version Repository Size
=======================================================================================================================================
Installing:
python36 x86_64 3.6.8-1.el7 ol7_developer_EPEL 66 k
Installing for dependencies:
python36-libs x86_64 3.6.8-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.8-1.el7.x86_64.rpm | 66 kB 00:00:00
(2/2): python36-libs-3.6.8-1.el7.x86_64.rpm | 8.6 MB 00:00:01
---------------------------------------------------------------------------------------------------------------------------------------
Total 7.3 MB/s | 8.6 MB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : python36-libs-3.6.8-1.el7.x86_64 1/2
Installing : python36-3.6.8-1.el7.x86_64 2/2
Verifying : python36-3.6.8-1.el7.x86_64 1/2
Verifying : python36-libs-3.6.8-1.el7.x86_64 2/2

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

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

Complete!
[gerald@localhost ~]$

You can verify the installation via python36 --version:

[gerald@localhost ~]$ python36 --version
Python 3.6.8
[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.