在 python 脚本中导入 cx_Oracle 失败。
我安装了 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 (Lion)
$ 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.
甲骨文 10.2
$ sqlplus -version
SQL*Plus: Release 10.2.0.4.0 - Production
另外,我的 ORACLE_HOME 文件夹中根本没有 /bin 目录,我只安装了即时客户端和 SDK。
ox_Oracle
$ pip freeze
PyRSS2Gen==1.0.0
...
cx-Oracle==5.1.1
(发现很多关于安装 cx_Oracle 的问题,但没有关于这个 - 谢谢)