【发布时间】:2011-12-31 11:32:12
【问题描述】:
无法让 cx_Oracle 与 Python 2.7 版/mac os 10.7.2 (Lion) 一起工作
另外一件事:我安装了 oracle 32 位,不确定是否正确。
Traceback (most recent call last):
File "reader.py", line 9, in <module>
import cx_Oracle
File "build/bdist.macosx-10.7-intel/egg/cx_Oracle.py", line 7, in <module>
File "build/bdist.macosx-10.7-intel/egg/cx_Oracle.py", line 6, in __bootstrap__
ImportError: dlopen(/Users/me/.python-eggs/cx_Oracle-5.1.1-py2.7-macosx-10.7-intel.egg-tmp/cx_Oracle.so, 2): Symbol not found: _OCIAttrGet
Referenced from: /Users/me/.python-eggs/cx_Oracle-5.1.1-py2.7-macosx-10.7-intel.egg-tmp/cx_Oracle.so
Expected in: flat namespace
in /Users/me/.python-eggs/cx_Oracle-5.1.1-py2.7-macosx-10.7-intel.egg-tmp/cx_Oracle.so
他们的关键问题似乎是无法找到_OCIAttGet,我认为这意味着它无法找到一个lib文件或其他东西。
在网上找到,有人在说DYLD_LIBRARY_PATH,但是我的已经设置好了,但是他在cxoracle.cfg文件中提到了,我找不到,这是我的问题吗?
编辑
在尝试使用 32 位模式 python 运行它后,我看到一个不同的错误。
Traceback (most recent call last):
File "reader.py", line 9, in <module>
import cx_Oracle
File "build/bdist.macosx-10.7-intel/egg/cx_Oracle.py", line 7, in <module>
File "build/bdist.macosx-10.7-intel/egg/cx_Oracle.py", line 3, in __bootstrap__
ImportError: No module named pkg_resources
- 我无法在我的计算机上运行 oracle 64 位版本,运行 sqlplus 时不断出现分段错误,这就是我使用 32 的原因。
二次编辑
其实无论我安装什么,都不是正确的版本.. 32位版本
ld: warning: ignoring file /opt/oracle/instantclient10_2/libclntsh.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
64 位版本:
ld: warning: ignoring file /opt/oracle/instantclient10_2/libclntsh.dylib, file was built for unsupported file format which is not the architecture being linked (x86_64)
我将尝试 11g,但它只有 64 位版本。
【问题讨论】:
标签: python macos python-2.7