If you finish cx_oracle, the command line runs right, but runs in sublime text and encounters this error:
not loaded:/ade/b/3071542110/oracle/rdbms/lib/libclntsh.dylib.11.1 from:/library /python/2.7/site-packages/cx_oracle.so not found
Well, congratulations. This can be solved because of some weird security considerations, the environment variable Dyld_library_path is incorrectly inherited in the Mac system, causing cx_oracle.so to find libclntsh.dylib.11.1.
So let's have a human flesh to tell cx_oracle.so where the file it wants.
Install_name_tool- change/ade/b/3071542110/oracle/rdbms/lib/libclntsh.dylib.11.1 $ORACLE _ HOME/libclntsh.dylib.11.1 /library/python/2.7/site-packages/cx_oracle.so
The purpose of this command is to tell the fourth line of this file that it originally thought in the second row of something, in fact, in the third row. So you need to write the second line according to the above error, then write the third line according to the location of your libclntsg.dylib.11.1, and then write the fourth line according to the Python position you want to use. For example, I use Anaconda python, and my fourth line is/users/qixiang/anaconda/lib/python2.7/site-packages/cx_oracle.so.
Then you will encounter another error, similar to
not loaded:/ade/dosulliv_ldapmac/oracle/ldap/lib/libnnz11.dylib from:/usr/local/ lib/share/oracle/installclient_11_2/libclntsh.dylib.11.1 not found
The problem is the same: libclntsh.dylib.11.1 can not find libnnz11.dylib, the solution is the same
Install_name_tool- change/ade/dosulliv_ldapmac/oracle/ldap/lib/libnnz11.dylib $ORACLE _ HOME/libnnz11.dylib $ORACLE _home/libclntsh.dylib.11.1
The difference is that you need to give permission to modify libclntsh.dylib.11.1 before this:
chmod 777 $ORACLE _home/libclntsh.dylib.11.1
Now you have solved the problem.
Cx_oracle running in sublime text encountered importerror error resolution