Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

How to Install cx_oracle in Python on MacOS?

  • Last Updated : 30 Sep, 2021

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.

Installation:

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 setup.py to install cx_Oracle 

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

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

curl https://files.pythonhosted.org/packages/be/bf/1dc153a103680b0831299e119c2281ecdec93fcfd27dd0a774a79a4f7267/cx_Oracle-8.2.1.tar.gz > 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 setup.py install

installing cx_Oracle on macOS using the setup.py 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.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!