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
- Open PyCharm and then Open your project.
- Click on the menu File > Settings and then the Settings window will open.
- In the Settings window, click on the Project node to expand and then click on the Project Interpreter.
- 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.

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()
cursor.execute("""
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)Output
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
