2016-02-07 102 views
1

嗨 - 我已经在Mac OS X Yosemite 10.10上成功安装了cx_Oracle,并且能够通过使用Python 2.7的mac终端查询我的oracle数据库。 11在终端。IDLE shell无法找到cx_Oracle的图像(原因是:找不到图像)

唯一的问题是,IDLE外壳应用程序无法导入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失踪?

+0

令人费解。你很好地表明你每次都运行相同的python二进制文件。你是否用一个图标运行IDLE?你有没有尝试使用'python -m idlelib.idle'从终端命令行运行它? (这可能会给出额外的错误信息。)您在两次导入尝试之间运行其他任何操作吗? –

+0

@TerryJanReedy我没有空转用的图标。那个图标被固定在我的码头上。运行: '蟒蛇-m idlelib.idle' 在MAC终端命令工作。我运行了这个命令,然后执行了'import cx_Oracle' ,我看到cx_Oracle被成功导入。 感谢您的帮助。我想,如果你提交你的答案,我会接受的,我打算用图标打开python 2.7.11将允许我仍然'import cx_Oracle' – Krusaderjake

+0

@TerryJanReedy。 – Krusaderjake

回答

1

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