【发布时间】: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