When installing or using cx_oracle, you need to use Oracel's link library, such as libclntsh.so.11.1, or there will be a variety of error messages .
Install the Oracle Instant client to get this link library and avoid installing the hundreds of Mega Oracle client.
Software:
Cx_oracle's homepage: http://cx-oracle.sourceforge.net/
Required Oracle link libraries:
Common Errors and workarounds:
First, Win32 binary installation
After installing Cx_oracle-5.0-11g.win32-py2.6.msi under Windows, the DLL fails to load when it is imported, as follows:
IDLE 2.6.1
>>> Import Cx_oracle
Traceback (most recent):
File "<pyshell#0>", line 1, in <module>
Import Cx_oracle
Importerror:dll load failed: The specified program could not be found.
Workaround :
Download Instantclient-basic-win32-11.2.0.4.zip from the Oracle site, and after extracting it, copy the Oci.dll file into the Python installation directory lib/site-packages, such as c:/ Python26/lib/site-packages
Second, Linux under binary installation
Under linux_x86_64, install cx_oracle-5.0.1-11g-py24-1.x86_64.rpm times wrong.
[Email protected] ~]# RPM-IVH cx_oracle-5.0.1-11g-py24-1.x86_64.rpm
error:failed dependencies:
libclntsh.so.11.1 () (64bit) is needed by cx_oracle-5.0.1-1.x86_64
Workaround :
Download the Basic-11.2.0.4.0-linux-x86_64.zip to/opt directory from the Oracle site and unzip it to see libclntsh.so.11.1 in the/opt/instantclient_11_2 directory
Setting environment variables
Vi/root/.bash_profile
Add the following two lines:
Export Oracle_home=/opt/oracle/instantclient_11_2
Export ld_library_path= $LD _library_path: $ORACLE _home
Run Source/root/.bash_profile make changes take effect
Create a symbolic link to this link library
CD $ORACLE _home
Ln-s libclntsh.so.11.1 libclntsh.so
Reinstall Cx_oracle
Note that the--nodeps parameter is added, otherwise the error will be reported
[Email protected] ~]# RPM-IVH--nodeps cx_oracle-5.0.1-11g-py24-1.x86_64.rpm
Problems and solutions of Cx_oracle module installation in Linux build Python environment