I want to query data from an Oracle database from a Python program and this could be done by using the cx_Oracle Python package. This package required some Oracle package pre-requisites so it cannot be installed thru pip directly.
The following steps are done on a Centos 7 machine with Python 2.7.
1. Download and install the following from Oracle.
2. The installed client should be located at /usr/lib/oracle/11.2/client64.
3. Create the /etc/ld.so.conf.d/oracle.conf.
4. Create the /etc/profile.d/oracle-client.sh.
export ORACLE_HOME=/usr/lib/oracle/11.2/client64/bin; export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$ORACLE_HOME/bin:\$ORACLE_HOME/lib
5. Quit the shell and login again.
6. Verify the $ORACLE_HOME and $LD_LIBRARY_PATH.
env | grep ORACLE env | grep LD_LIBRARY_PATH
7. If the above env variables exists, you can install the cx_Oracle package thru pip.
pip install cx_Oracle
Reference: StackOverflow – install cx_oracle for python