How to Import CX_Oracle in PyCharm?

You have installed the Python and cx_Oracle package, and now you want to import the cx_Oracle package in PyCharm to use in your Python applications. But to import the cx_Oracle in PyCharm first, you need to install the cx_Oracle package in PyCharm too. Below I am explaining the steps to how to install the cx_Oracle package in PyCharm.

But if you haven't installed the cx_Oracle package yet, then you can check the following post to how to install cx_Oracle package for Python on Windows.

Follow These Steps to Install and Import CX_Oracle Package in PyCharm

  1. Open PyCharm and then Open your project.
  2. Click on the menu File > Settings and then the Settings window will open.
  3. In the Settings window, click on the Project node to expand and then click on the Project Interpreter.
  4. Then on the right side, click on the + button to open Available Packages window, as shown in below image. Then search for cx_Oracle in the search box. Below you will find the cx_Oracle package. Click on it to select and then click on the Install Package button as shown below.

Install cx_Oracle package in PyCharm

You have installed the cx_Oracle package, and now you can use it in your Python applications by importing it.

Import cx_Oracle in PyCharm Example

import cx_Oracle

connection = cx_Oracle.connect("scott", "tiger", "localhost/orcl")

cursor = connection.cursor()

    SELECT empno, ename
    FROM emp
    WHERE deptno = :did""",
    did = 30)
print("List of Employees in Department: 30")
for fempno, fename in cursor:
    print("Employee No:", fempno, "Employee Name:", fename)


List of Employees in Department: 30
Employee No: 7499 Employee Name: ALLEN
Employee No: 7521 Employee Name: WARD
Employee No: 7654 Employee Name: MARTIN
Employee No: 7698 Employee Name: BLAKE
Employee No: 7844 Employee Name: TURNER
Employee No: 7900 Employee Name: JAMES

Process finished with exit code 0

See also:

2 thoughts on “How to Import CX_Oracle in PyCharm?”

  1. Hi Vinish,

    I am having some issues because when I search PyCharm, the cx_Oracle package does not display. Do you perhaps know what could be causing this?

    Thank you for posting this article.



Leave a Comment