在python脚本中导入cx_Oracle失败。用MacOSX导入cx_Oracle(python)
我安装了cx_Oracle,使用“pip install cx_oracle” - 工作正常,报告已安装。
现在,当我尝试:
import cx_Oracle
我收到以下错误
Traceback (most recent call last):
File "reader.py", line 9, in <module>
import cx_Oracle
ImportError: dlopen(/Library/Python/2.7/site-packages/cx_Oracle.so, 2): Symbol not found: _OCIAttrGet
Referenced from: /Library/Python/2.7/site-packages/cx_Oracle.so
Expected in: flat namespace
in /Library/Python/2.7/site-packages/cx_Oracle.so
其他信息:
Python版本2.7/MAC OS 10.7.2(狮子)
$ python
Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Oracle 10.2
$ sqlplus -version
SQL*Plus: Release 10.2.0.4.0 - Production
另外,我没有/ bin目录中的所有在我的ORACLE_HOME文件夹,只安装了即时客户端和SDK我有。
ox_Oracle
$ pip freeze
PyRSS2Gen==1.0.0
...
cx-Oracle==5.1.1
(发现了很多在获取安装cx_Oracle问题,但没有在这 - 感谢)
我可能拥有它,并会发布我自己的答案,如果它是真的。我正在查看setup.py脚本,并注意到它使用文件夹名称来猜测版本。我在10.1文件夹中安装了10.2,可能是这个问题。 – nycynik
好吧,我手动安装CX_ORACLE而不是使用pip,现在我有一个不同的,但基本相同的问题。文件“reader.py”,第9行,在 import cx_Oracle 文件“build/bdist.macosx-10.7-intel/egg/cx_Oracle.py”,第7行,在 文件“build/bdist.macosx-10.7 -intel/egg/cx_Oracle.py“,第6行,在__bootstrap__ ImportError:dlopen(/Users/me/.python-eggs/cx_Oracle-5.1.1-py2.7-macosx-10.7-intel.egg-tmp/ cx_Oracle.so,2):找不到符号:_OCIAttrGet –
nycynik