泊坞窗运行错误:DPI-1047:无法找到64位Oracle客户端库

时间:2020-02-10 11:31:41

标签: python-3.x docker cx-oracle

我正在尝试使用Oracle数据库连接对一个非常简单的python应用程序进行docker化,并在Docker上执行它。此应用程序在我的本地计算机上运行良好。

我能够成功构建此应用程序,但在Docker上执行该应用程序时出现错误。

DockerFile:

paypal.Buttons({
  locale: 'en_US',
  style: {
    size: 'small',
    color: 'gold',
    shape: 'pill',
    label: 'pay',
    layout: 'horizontal',
    fundingicons: 'false',
    height: 46
  }
}).render('#paypal-button-container');

File.py:

FROM python:3

ADD File.py /

RUN pip install cx_Oracle
RUN pip install pandas
RUN pip install openpyxl

CMD [ "python", "./File.py" ]

错误:

docker运行python_batchdriver:latest

cx_Oracle.DatabaseError:DPI-1047:无法找到64位Oracle客户端库:“ libclntsh.so:无法打开共享库文件:没有这样的文件或目录”。请参见https://oracle.github.io/odpi/doc/installation.html#linux以获取帮助

1 个答案:

答案 0 :(得分:0)

对于cx_Oracle,您还需要安装Oracle Instant Client库。参见cx_Oracle installation instructions

有多种方法可以自动在Docker中进行安装。一个例子是:

RUN wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip && \
    unzip instantclient-basiclite-linuxx64.zip && \
    rm -f instantclient-basiclite-linuxx64.zip && \
    cd instantclient* && \
    rm -f *jdbc* *occi* *mysql* *jar uidrvci genezi adrci && \
    echo /opt/oracle/instantclient* > /etc/ld.so.conf.d/oracle-instantclient.conf && \
    ldconfig

您还将需要libaio或libaio1软件包。

请参见Docker for Oracle Database Applications in Node.js and Python

另请参见Install Oracle Instant client into Docker container for Python cx_Oracle 请注意,如果您未使用基于Debian的Linux发行版,则步骤可能会有所不同。