Last active
February 23, 2017 22:29
-
-
Save jarshwah/3863378 to your computer and use it in GitHub Desktop.
Installing cx_Oracle on Linux Redhat 6 using RPMs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# assuming python and pip are already installed | |
# installing the instantclient is usually where problems happen | |
# download the following files from oracle | |
# | |
# oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm | |
# oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm | |
# oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm | |
# install the rpms | |
rpm -ivh oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm | |
rpm -ivh oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm | |
rpm -ivh oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm | |
# the sqlplus package isn't specifically needed, but is usually useful for testing and command line sql connections | |
# configure oracle env (modify exact path based on version of rpm you download) | |
vim /etc/profile.d/oracle.sh | |
#!/bin/bash | |
LD_LIBRARY_PATH="/usr/lib/oracle/11.2/client64/lib:${LD_LIBRARY_PATH}" | |
export LD_LIBRARY_PATH | |
TNS_ADMIN="/etc/oracle" | |
export TNS_ADMIN | |
ORACLE_HOME="/usr/lib/oracle/11.2/client64/lib" | |
export ORACLE_HOME | |
# actually set the env vars above in your session | |
source /etc/profile.d/oracle.sh # or just logout/login | |
# copy/create your tnsnames.ora file | |
touch /etc/oracle/tnsnames.ora | |
# symlink headers to ORACLE_HOME to avoid "cannot locate Oracle include files" error | |
mkdir /usr/lib/oracle/11.2/client64/lib/sdk | |
ln -s /usr/include/oracle/11.2/client64 /usr/lib/oracle/11.2/client64/lib/sdk/include | |
# done. Install cx_Oracle | |
pip install cx_Oracle | |
jarshwah I think you have a mistake,
ORACLE_HOME="/usr/lib/oracle/11.2/client64/lib"
Should be
ORACLE_HOME="/usr/lib/oracle/11.2/client64"
thanks buddy .
Thanks a lot for this ; you will also need python-devel package for the compilation
thankyou very much!
Thank you. But in my case, I changed that code
symlink headers to ORACLE_HOME to avoid "cannot locate Oracle include files" error
mkdir /usr/lib/oracle/11.2/client64/sdk
ln -s /usr/include/oracle/11.2/client64 /usr/lib/oracle/11.2/client64/sdk/include
because for me does worked that variable
ORACLE_HOME="/usr/lib/oracle/11.2/client64"
Nice!! Thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@mbannert did you source the
/etc/profile.d/oracle
file beforepip install cx_Oracle
? Probably a stupid question, but that's the only thing I could see going wrong here.What did you try running
./configure
against? I didn't want to try installing cx_Oracle from source myself if that's what you were referring to.