使用Mac OSX在ipython中导入cx_oracle错误

时间:2015-11-16 15:39:49

标签: python macos ipython cx-oracle

当我在python

中跑步时
import cx_Oracle

这是成功的。

但是,当我在ipython中投放时,会引发错误:

In [1]: import cx_Oracle
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-d1ecebcba3d2> in <module>()
----> 1 import cx_Oracle

ImportError: dlopen(/Users/roy/anaconda/lib/python2.7/site-packages/cx_Oracle.so, 2): Library not loaded: @rpath/libclntsh.dylib.11.1
Referenced from: /Users/roy/anaconda/lib/python2.7/site-packages/cx_Oracle.so
Reason: image not found

以下是我的环境:

Mac OSX EL Capitan 10.11.1
Python 2.7.10 :: Anaconda 2.1.0 (x86_64)
ipython 3.2.0
instantclient-basic-macos.x64-11.2.0.4.0.zip
instantclient-sdk-macos.x64-11.2.0.4.0.zip
cx_Oracle 5.2

而且,这些是安装步骤:Build and Install cx_Oracle on Mac Leopard Intel

这些项目已添加到.bash_profile

export ORACLE_HOME=/Users/roy/oracle/instantclient_11_2
export DYLD_LIBRARY_PATH=$ORACLE_HOME
export LD_LIBRARY_PATH=$ORACLE_HOME

1 个答案:

答案 0 :(得分:-1)

我已经解决了。刚刚关闭无根系统完整性保护。 https://www.quora.com/How-do-I-turn-off-the-rootless-in-OS-X-El-Capitan-10-11