【问题标题】:IDLE shell not able to find image for cx_Oracle (Reason: image not found)IDLE shell 找不到 cx_Oracle 的图像(原因:找不到图像)
【发布时间】:2016-05-17 11:33:23
【问题描述】:

嗨 - 我已经在 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
>>> 

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

【问题讨论】:

  • 令人费解。您很好地表明您每次都在运行相同的 python 二进制文件。您是否使用图标运行 IDLE?您是否尝试使用python -m idlelib.idle 从终端命令行运行它? (这可能会产生额外的错误消息。)您在两次导入尝试之间是否运行了其他任何操作?
  • @TerryJanReedy 我确实用图标运行了 IDLE。该图标固定在我的底座上。在 mac 终端中运行:python -m idlelib.idle 命令有效。我运行了命令,然后执行了import cx_Oracle,我看到 cx_Oracle 已成功导入。谢谢你的帮助。我想我认为用图标打开 python 2.7.11 会让我仍然import cx_Oracle
  • @TerryJanReedy 如果您提交答案,我会接受。

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


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2020-11-17
    • 2021-10-12
    • 2019-03-05
    • 2018-09-11
    • 1970-01-01
    • 2013-12-25
    • 2012-03-20
    • 2013-07-16
    • 1970-01-01
    相关资源
    最近更新 更多