Open In App

How to Install cx_oracle in Python on MacOS?

Last Updated : 30 Sep, 2021
Like Article

In this article, we will learn how to install cx_Oracle in Python on MacOS. The cx_Oracle is a Python extension module that enables access to Oracle Database. It conforms to the Python database API 2.0 specification with a considerable number of additions and a couple of exclusions. See the homepage for a feature list.


Method 1: Using pip to install cx_Oracle Package

Follow the below steps to install the cx_Oracle package on macOS using pip:

Step 1: Install the latest Python3 in MacOS

Step 2: Check if pip3 and python3 are correctly installed.

python3 --version
pip3 --version

checking python and pip version in macos

Step 3: Upgrade your pip to avoid errors during installation.

pip3 install --upgrade pip

upgrading pip in macos

Step 4: Enter the following command to install cx_Oracle using pip3.

pip3 install cx_Oracle 

installing cx_Oracle package on macOS using pip

Method 2: Using to install cx_Oracle 

Follow the below steps to install the cx_Oracle package on macOS using the file:

Step 1: Download the latest source package of cx_Oracle for python3 from here.

curl > cx_Oracle.tar.gz

downloading the source package for cx_Oracle in macos

Step 2: Extract the downloaded package using the following command.

tar -xzvf cx_Oracle.tar.gz

extracting the cx_Oracle.tar.gz file in macos

Step 3: Go inside the folder and Enter the following command to install the package.

Note: You must have developer tools for XCode MacOS installed in your system

cd cx_Oracle-8.2.1
python3 install

installing cx_Oracle on macOS using the file

Verifying cx_Oracle installation on macOS:

Make the cx_Oracle import in your python terminal to verify if the installation has been done properly:

import cx_Oracle 

Verifying cx_Oracle installation on macOS

If there is any error while importing the module then is not installed properly.

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads