Tag Archives: Oracle

Installing cx_Oracle on Debian 7.1.0

Written while working on a 64bit Debian 7.1.0 Installation with 64bit Python for an Oracle 11g database 


This is by far one of the most annoying things i have had to do in the past few months, but like all programming related problems, once you crack it, it doesn’t seem so hard anymore. Though i do wish Oracle tried just a bit to make the process easier for developers.

Anyhow here’s my Step by Step on installing cx_Oracle


  • Install Python if not installed taking note of whether it is 32bit or 64bit.

NOTE: To find out if your Python installation is 32bit or 64bit, in the shell, enter the command python -c ‘import struct; print(8 * struct.calcsize(“P”))

  • Install package python-dev
  • Install package unzip
  • Install package libaio1
  • Download the Python driver for cx_Oracle from here taking care to select the appropriate package matching your system installation of Python(32bit or 63bit) and version of your Oracle database(11g).
  • Download  zip of Instant Client PackageBasic and Instant Client Package – SDK from here. Be sure to select the version that matches your system installation of Python and your Oracle Database version e.g Python 32bit and Oracle 11g.

Stepsdownload (1) 

  • Move and extract the zips Instant Client Package – Basic and Instant Client Package – SDK in the location /usr/local/bin
  • Enter the following commands directly into your linux shell
    • export ORACLE_HOME=/usr/local/bin/instantclient_11_2 
    • export LD_LIBRARY_PATH=/usr/local/bin/instantclient_11_2 
  • Inside the directory /usr/local/bin/instantclient_11_2 create symbolic links to the library files by typing:
    • ln -s libclntsh.so.11.1 libclntsh.so
    • ln -s libnnz11.so libnnz.so 
    • ln -s libocci.so.11.1 libocci.so 
    • ln -s libocijdbc11.so libocijdbc.so 
  • Go to directory cx_Oracle was downloaded into and extract it.
  • Enter the cx_Oracle directory and directly in the linux shell run the commands
    • python setup.py build
    • python setup.py install 
  • In linux shell type python -c ‘import cx_Oracle 
  • If no error message is seen the Install is successful
  • Jubilation \o/ download

Happy Hunting.



Leave a comment

Filed under Code