加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

无法让cx_Oracle与Python版本2.7 / mac os 10.7.2(Lion)一起使用

发布时间:2020-12-12 15:12:39 所属栏目:百科 来源:网络整理
导读:无法让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与 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",in <module>
     import cx_Oracle
   File "build/bdist.macosx-10.7-intel/egg/cx_Oracle.py",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位版本.

如果您使用Apple提供的Python 2.7,它将更喜欢以64位模式运行,如果您安装了仅32位的Oracle库,这将是一个问题.您可以通过以下方式启动来尝试强制Python以32位模式运行:
arch -i386 python2.7

如果你总是小心地通过/usr/bin/python启动python,你也可以使用Apple的Python手册页中描述的任何一种方法,即设置VERSIONER_PYTHON_PREFER_32_BIT环境变量或通过默认值设置永久默认值.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读