How to fix: cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library - Python

后端 未结 4 1794
失恋的感觉
失恋的感觉 2021-01-01 18:45

I am establishing a connection to oracle 11g which is in a remote server using cx_oracle 7 with python 3.6.7. my OS in Ubuntu 18.04

I have installed oracle instant c

4条回答
  •  孤独总比滥情好
    2021-01-01 19:14

    I was facing the exact same problem. This is what worked for me:

    • First, I downloaded the Oracle Basic zip file. In my case, I got the 64-bit version.
    • After that, I unzipped it in an opt directory. I had to use sudo in my system
        $ sudo mkdir -p /opt/oracle  
    
        $ cd /opt/oracle  
    
        $ sudo unzip /opt/oracle/instantclient-basic-linux.x64-19.8.0.0.0dbru.zip  
    
    • Then I installed libaio1. Note that I am working with Ubuntu
        $ sudo apt-get install libaio1
    
    • Finally, I added the path to the external variable LD_LIBRARY_PATH
        $ vim ~/.bashrc  
    
    • And added this line to the .bashrc file
        export LD_LIBRARY_PATH=/opt/oracle/instantclient_19_8:$LD_LIBRARY_PATH  
    
    • After saving the .bashrc file, I sourced it:
        $ source ~/.bashrc
    

    Then my Python script worked nicely again.

    See also the cx_oracle documentation

提交回复
热议问题