If you followed the guide that you referenced, you've also created a script in /etc/profile.d/
. Make sure that this script ends in .sh
.
Your problem is probably related to loading the script from this directory, which I'm guessing is because you're running python from a non-login bash shell.
To verify that this is the case, try to invoke bash with bash --login
, or do source /etc/profile
in an existing bash shell. Then check if the variables ORACLE_HOME
and LD_LIBRARY_PATH
gets defined with a sensible value.
If that works, there are some relevant questions (and answers!) on scripts in /etc/profile.d
at AskUbuntu that might be helpful:
--
edit:
The environment variables are inherited – if the shell has a variable, then anything started from that shell should inherit those variables.
With this in mind, try to do:
$ bash --login
$ python
>>> import os
>>> print os.environ.get('ORACLE_HOME', '<not set>')
>>> print os.environ.get('LD_LIBRARY_PATH', '<not set>')
>>> import cx_Oracle