Problems and solutions of Cx_oracle module installation in Linux build Python environment

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.