当我在 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
最佳答案
我已经解决了。只需关闭无根系统完整性保护。 https://www.quora.com/How-do-I-turn-off-the-rootless-in-OS-X-El-Capitan-10-11
关于python - 使用 Mac OSX 在 ipython 中导入 cx_oracle 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33739136/