无法在Mac中加载64位Oracle Client库 [英] 64-bit Oracle Client library cannot be loaded in mac

查看:1444
本文介绍了无法在Mac中加载64位Oracle Client库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为Oracle数据库连接创建了一个示例Python脚本,用于运行数据库测试查询,我在Windows上运行了相同的脚本,并且运行良好,但是在Mac上运行时,它一次又一次地向我展示了此异常. >

I have created a sample Python script for Oracle Database connectivity for running queries for Database testing, I have ran the same script on Windows and its running fine but while running on Mac, its showing me this exception again and again.

cx_Oracle.DatabaseError: DPI-1047: 64-bit Oracle Client library cannot be loaded: "dlopen(libclntsh.dylib, 1): image not found". See https://oracle.github.io/odpi/doc/installation.html#macos for help

我已经在bash_profile上更改了我的环境变量,如下所示:

I have changed my Environmental Variable on bash_profile like these:

export ORACLE_HOME= /opt/oracle/instantclient_12_2/
export DYLD_LIBRARY_PATH=$ORACLE_HOME
export LD_LIBRARY_PATH=$ORACLE_HOME
export PATH=$ORACLE_HOME:$PATH

仍然无法正常工作.有人可以在这里帮我吗.谢谢

Still not working. Can someone help me here. Thanks

推荐答案

来自

From the Installation Instructions make sure you are not using the default Python binary.

然后,如您所知,在新的python上安装cx_Oracle.

Then install cx_Oracle on the new python, as you already know how.

最后,请确保已解压缩和配置Instant Client:

Finally, make sure Instant Client is unzipped and configured:

mkdir ~/lib
ln -s /opt/oracle/instantclient_12_2/libclntsh.dylib ~/lib/

没有设置DYLD_LIBRARY_PATH的意义,因为macOS的SIP保护会使其停止工作.自cx_Oracle 5天以来,无需为cx_Oracle设置ORACLE_HOME. LD_LIBRARY_PATH主要是UNIX,所以也不要设置.

There's no point setting DYLD_LIBRARY_PATH since macOS's SIP protection stops it working. There hasn't been a need to set ORACLE_HOME for cx_Oracle since the cx_Oracle 5 days. And LD_LIBRARY_PATH is mostly a UNIX thing, so don't set that either.

这篇关于无法在Mac中加载64位Oracle Client库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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