python - IDLE shell 无法找到 cx_Oracle 的镜像(原因 : image not found)

标签 python macos python-2.7 python-idle cx-oracle

您好 - 我已在 Mac OS X Yosemite 10.10 上成功安装了 cx_Oracle,并且我可以在终端中使用 Python 2.7.11 通过 Mac 终端查询我的 Oracle 数据库。

唯一的问题是 IDLE shell 应用程序无法导入 cx_Oracle 并显示以下错误:

Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 12:54:16) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>> import cx_Oracle

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import cx_Oracle
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cx_Oracle.so, 2): Library not loaded: /ade/b/3071542110/oracle/rdbms/lib/libclntsh.dylib.11.1
  Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cx_Oracle.so
  Reason: image not found

以下是我在 Mac 终端中看到的内容(然后我可以继续成功查询数据库):

Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 12:54:16) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle
>>> 

IDLE 不允许导入 cx_Oracle,我缺少什么?

最佳答案

不要从固定图标运行 IDLE,而是使用 python -midlelib.idle 运行它。 (对于 3.x,不需要 .idle。)我不知道为什么在这种情况下效果更好,但我知道从图标运行有时会隐藏所需的信息,例如将运行,当前 python 将运行的工作目录,启动参数和一些错误消息。

关于python - IDLE shell 无法找到 cx_Oracle 的镜像(原因 : image not found),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35258901/

相关文章:

python - 如何以优雅且安全(关于Python模块重新加载)的方式使用super()?

Python MySql 选择单列返回奇怪的值

python - 修改一个元素会修改Python中的整列

javascript - 类型错误状态文本 : "Internal Server Error" for a simple post "LIKE" feature in Django using Ajax

在 visual studio code 中快速编码

c++ - 在 MacOS 上使用 Bazel 构建时调试 C++ 代码不起作用

python - "getNumPartitions"是一个昂贵的操作吗?

python - 生成一个 View 来识别 python 列中特定值的第一个条目和最后一个条目

python - 在 Python 中使用 LombScargle 对 HRV 数据进行频谱分析

macos - Macos 上的 jmeter 启动 GUI 时卡住