安装多个oracle客户端版本时如何在python中设置oracle客户端库路径 [英] how to set oracle client library path in python when multiple oracle client version installed

查看:439
本文介绍了安装多个oracle客户端版本时如何在python中设置oracle客户端库路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Linux机器上安装了2个oracle客户端。 10.2和12.2。
我必须用于cx_oracle的第二个,而我无法接触的其他较旧的实现则需要较旧的一个。

i have 2 oracle client installed in linux machine. 10.2 and 12.2. Second one i have to use for cx_oracle and older one is needed for other older implementation which i cant touch.

当我在其中添加第二个12.2 oracle客户端库时LD_LIBRARY_PATH路径并运行简单的oracle连接python程序,它给我下面的错误

when i add second 12.2 oracle client library in LD_LIBRARY_PATH path and running simple oracle connection python program, it is giving me below error

cx_Oracle.DatabaseError:DPI-1050:Oracle Client库位于版本10.2,但必须是版本11.2或更高版本

cx_Oracle.DatabaseError: DPI-1050: Oracle Client library is at version 10.2 but must be at version 11.2 or higher

如何在不接触旧配置的情况下使用新版本的客户端库? / p>

How can i use the newer version of client library without touching the old config?

推荐答案

在其他Oracle库之前,编写一个LD_LIBRARY_PATH中列出了12.2 Oracle Client库的shell脚本,然后调用Python。

Write a shell script that lists the 12.2 Oracle Client library in LD_LIBRARY_PATH before other Oracle libraries, and then invokes Python.

#!/bin/sh
export LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2
python "$@"

这篇关于安装多个oracle客户端版本时如何在python中设置oracle客户端库路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆