Oracle Linux for Python Developers

All about developing with Python on Oracle Linux

  • Home > 
  • Oracle Linux for Python Developers

About Python on Oracle Linux

There are several ways to get started with Python development on Oracle Linux. Oracle Linux yum server offers updates for system Python included with Oracle Linux as well as new versions of Python via the Software Collection Library (SCL) and EPEL (Oracle Linux 7 only). The different Python versions available and the corresponding repository and RPM names are summarized in the tables below.

Oracle Linux 7 Repository: RPM name
Python Version Base Oracle Linux Software Collection Library EPEL

ol7_software_collections: rh-python36 ol7_developer_EPEL: python36

ol7_software_collections: rh-python35


ol7_software_collections: rh-python34 ol7_developer_EPEL: python34
2.7 ol7_latest: python

Oracle Linux 6 Repository: RPM name
Python Version Base Oracle Linux Software Collection Library
3.6 ol6_software_collections: rh-python36
3.5 ol6_software_collections: rh-python35
3.4 ol6_software_collections: rh-python34
2.6 ol6_latest: python

Installing Python

Enabling Required Repositories

The installation instructions below require different Oracle Linux yum server repositories to be enabled, depending on what you are installing. For example, to enable the ol7_developer_EPEL repository:

$ sudo yum install -y yum-utils
$ sudo yum-config-manager --enable ol7_developer_EPEL

If your yum configuration doesn't have the required repository, grab the latest Oracle Linux yum configuration by running the these commands as the root user:

On Oracle Linux 7

# cd /etc/yum.repos.d
# mv public-yum-ol7.repo public-yum-ol7.repo.bak
# wget

On Oracle Linux 6

# cd /etc/yum.repos.d
# mv public-yum-ol6.repo public-yum-ol6.repo.bak
# wget

System Python

Python is an integral part of the Oracle Linux operating system. Oracle Linux 6 has Python 2.6 and Oracle Linux 7 has Python 2.7 already installed.

Installing Python From the EPEL for Oracle Linux 7 repository

Oracle Linux yum server hosts an EPEL (Extra Packages for Enterprise Linux) repository based on upstream Fedora EPEL. This repository includes recent versions of Python. You can install and use Python from EPEL on Oracle Linux using a virtual environment to isolate the newly installed Python interpreter, libraries and scripts from system Python.

To install and enable Python 3.6 in a virtual environment using venv, enable the ol7_developer_EPEL repo and run:

$ sudo yum install -y python36
$ python3.6 -m venv py36env
$ source py36env/bin/activate

Installing Python From the Software Collection Library

The Software Collection Library (SCL) is intended for development environments which require access to the latest features of software components such as Perl, PHP, or Python. For these environments, it's important to minimize the disruption of system processes that rely on the versions of these components. The SCL enables you to install and use several versions of the same software on a system, simultaneously, and without disruption.

To install Python 3.6 from the SCL on Oracle Linux 7, enable the ol7_software_collections repo and run:

$ sudo yum -y install scl-utils rh-python36

To enable and use Python 3.6 from the SCL:

$ scl enable rh-python36 bash
$ python

cx_Oracle: Connecting Python to Oracle Database

cx_Oracle is a module that enables access to Oracle Database and conforms to the Python database API specification. For more details, see the cx_Oracle documentation

Installing and Configuring Oracle Instant Client

cx_Oracle depends on Oracle Instant Client. To install and configure Oracle Instant Client:

Download Install the Instant Client "Basic Package" RPM for Oracle Linux x86-64, available here. Then, install the Instant Client RPM via yum and set up the environment such that cx_Oracle can find Instant Client libraries:

$ sudo yum -y install ./oracle-instantclient12.2-basic-
$ sudo sh -c "echo /usr/lib/oracle/12.2/client64/lib > \
$ sudo ldconfig

Installing cx_Oracle for System Python

The Oracle Linux 6 and 7 Developer repositories include cx_Oracle RPMs.* To install cx_Oracle for System Python on Oracle Linux 7, enable the ol7_developer repo and run:

$ sudo yum -y install python-cx_Oracle

*) Note for Python 2.6, use the older cx_Oracle 5.2 release.

Installing cx_Oracle for Python from EPEL

At the moment, there are no cx_Oracle RPMs for Python from EPEL. However, you can install cx_Oracle via pip. Assuming you have installed and enabled Python 3.6 from EPEL in a virtual environment and installed InstantClient, as described above.

$ python -m pip install cx_Oracle

Installing cx_Oracle for Python from the Software Collection Library (SCL)

cx_Oracle RPM built to work with SCL Python versions are named according to the format:


For example, to install the matching cx_Oracle RPM for Python 3.6 from SCL:

$ sudo yum -y install rh-python36-python-cx_Oracle


Oracle Linux customers receive support for System Python and Python packages in the Software Collection Library. Community support is available in the Python and Oracle Developer Community.


Contact Us

Subscribe | Careers | Contact Us | Legal Notices | Terms of Use | Your Privacy Rights