Install cxOracle on Windows. These installation instructions assume that you are on 64-bit Windows and have a Windows x64 Oracle 11gR2 database running on your machine. The Oracle database can be on any edition of Oracle (Express, Standard, Enterprise). Use Python for PL/SQL operations in Oracle Database. By Blaine Carter. November/December 2018. After you’ve gotten the hang of performing basic create, retrieve, update, delete (CRUD) operations with the cxOracle driver for Python, you’re ready to start tapping into some of the real power of Oracle Database. CxOracle is a Python extension module that allows access to Oracle databases and conforms to the Python database API specification version cxOracle - Browse /5.1.2 at SourceForge.net Join/Login. Oracle Live: Build the Future of Business with Oracle Cloud Applications. Learn how Oracle Advertising and CX and other cloud applications are delivering constant innovation, higher productivity, and industry-leading security.

Table of Contents

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 8
Python Version AppStream Module
3.8 python38
3.6 python36
2.7 python27

Oracle Linux 7Repository: RPM name
Python Version Base Oracle Linux Software Collection Library EPEL
ol7_software_collections: rh-python38
3.6 ol7_latest: python3 ol7_software_collections: rh-python36 ol7_developer_EPEL: python36
3.5 ol7_software_collections: rh-python35

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

Oracle Linux 6Repository: 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 configured, depending on what you are installing. For example, to enable the ol7_developer_EPEL and the ol7_oracle_instantclient repository:

$ sudo yum install -y oracle-epel-release-el7 oracle-release-el7

If yum is unable to find any of the packages mentioned below, follow the instructions on our Getting Started page to ensure your system is set up correctly to work with our release packages.

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 and includes Python 3 as of Oracle Linux 7.7. Python is not installed by default on Oracle Linux 8. Instead, different versions of Python can be installed via AppStreams.

About Support for Python 2

The Python Software Foundation, the community organization behind Python, has announced that the Python 2 series has reached end-of-life on January 1, 2020 with release 2.7. Because Oracle Linux is an enterprise Linux distribution, support decisions for components in the operating system are made independently from those made in the upstream community. Therefore, Python 2 remains supported in Oracle Linux as outlined below.

Continued support for Python 2 in Oracle Linux 7 and Oracle Linux 6

Python 2 remains supported in Oracle Linux 7 and Oracle Linux 6. As such, critical security errata and select high-impact critical bug fixes will be provided while Oracle Linux 7 and Oracle Linux 6 are covered under Oracle Linux Premier support as detailed in the Lifetime Support Policy

Continued support for Python 2 in Oracle Linux 8

Python 2 is delivered in Oracle Linux 8 via Application Streams and may optionally be installed. Python 2 is supported in Oracle Linux 8 and critical security errata and select high-impact critical bug fixes will be provided according to this Oracle Linux 8 Application Stream Life Cycle.

Installing Python 3 from the Oracle Linux 7 Latest Repository

Oracle Linux 7.7 and newer include Python 3.

To install Python 3 from the Oracle Linux 7 latest repository:

$ sudo yum install -y python3

Note that python3-devel is in the ol7_optional_latest repository. To install python3-devel:

$ sudo yum install -y --enablerepo ol7_optional_latest python3-devel

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.

Cx_oracle Tutorial

To install Python 3.8 from the SCL on Oracle Linux 7, install oracle-softwarecollection-release-el7 and then install scl-utils and rh-python38:

$ sudo yum install -y oracle-softwarecollection-release-el7
$ sudo yum -y install scl-utils rh-python38

To enable and use Python 3.8 from the SCL:

$ scl enable rh-python38 bash
$ python

Installing Python on Oracle Linux 8 via AppStream Modules

Oracle Linux 8 introduces the concept of Application Streams, where multiple versions of user-space components can be delivered and updated more frequently than the core operating system packages in RPM format or groups of related RPMs called Modules. Oracle Linux 8 offers several independently updated versions of Python via Module Streams.

To list available Module Streams for Python:

$ sudo yum module list grep python

To install the Python 3.6 module and run Python 3.6:

$ sudo yum module install python36
$ python3

To use pip for installing additional Python modules:

$ python3 -m pip install <module name>

To create a virtual environment using venv:

$ python3 -m venv py36env
$ source py36env/bin/activate

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

About Oracle Instant Client

cx_Oracle depends on Oracle Instant Client. On Oracle Linux yum server Oracle Instant Client 18.3 RPMs are in the ol7_oracle_instantclient and ol6_oracle_instantclient repositories. Assuming you have enabled the repository for Oracle Instant Client appropriate for your Oracle Linux release, it will be installed as a dependency. Be sure to set your environment such that cx_Oracle can find the required Oracle Instant Client libraries by following these steps. cx_Oracle is built with Oracle Client 18.3, which connects to Oracle Database 11.2 and greater. Older releases of Oracle Instant Client are available on OTN.

Installing cx_Oracle for Python 3

To install cx_Oracle for Python 3 on Oracle Linux 7:

$ sudo yum -y install oraclelinux-developer-release-el7
$ sudo yum -y install python36-cx_Oracle

To install cx_Oracle for Python 3 on Oracle Linux 8:

$ sudo dnf -y install oracle-instantclient-release-el8
$ sudo dnf -y install python36-cx_Oracle

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 oraclelinux-developer-release-el7
$ 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

Important: Configuring Your Environment for Oracle Instant Client


Finally, for Oracle Instant Client releases before 19.x, you must set up the environment so that cx_Oracle can find the necessary libraries. For example, for Oracle Instant Client release 18.3:

$ sudo sh -c 'echo /usr/lib/oracle/18.3/client64/lib > /etc/ld.so.conf.d/oracle-instantclient.conf'
$ sudo ldconfig


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.


  • Dev Gym: CRUD operations using cx_Oracle and Python
  • Oracle Linux yum server FAQ: Configuring yum proxy