本文介绍了如何在El Capitan上安装cx_Oracle的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我了解,与SIP相关的一些更改使安装此操作变得困难.

As I understand it, there was some change related to SIP that makes installing this difficult.

这些页面具有背景和安装建议. http://sourceforge.net/p/cx-oracle/mailman/message/34534872/ http://stefanoapostolico.com/2015/10/08/install_cx_oracle_with_sip_enabled.html

These pages have the background and advice to install. http://sourceforge.net/p/cx-oracle/mailman/message/34534872/, http://stefanoapostolico.com/2015/10/08/install_cx_oracle_with_sip_enabled.html

将所有这些放在一起,这是将其安装到我的virtualenv中的最好的镜头,但是,还是不好.

Putting all this together, here was my best shot at installing it to my virtualenv but alas, still no good.

我得到的错误是:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: dlopen(/Users/me/sx_direct_env/lib/python2.7/site-packages/cx_Oracle.so, 2): Library not loaded: /b/227/rdbms/lib/libclntsh.dylib.10.1
  Referenced from: /Users/me/sx_direct_env/lib/python2.7/site-packages/cx_Oracle.so
  Reason: image not found

这是我所有的安装步骤:

Here are all of my install steps:

$ cd /Users/me/sx_direct_env/lib/python2.7
$ mkdir oracle
$ cd oracle
$ export ORACLE_HOME=$PWD
$ export DYLD_LIBRARY_PATH=$ORACLE_HOME
$ export LD_LIBRARY_PATH=$ORACLE_HOME
$ export PATH=$PATH:$ORACLE_HOME
$ unzip ~/Downloads/instantclient-basic-macos.x64-11.2.0.4.0.zip
$ unzip ~/Downloads/instantclient-sdk-macos.x64-11.2.0.4.0.zip
$ mv instantclient_11_2/* .
$ rmdir instantclient_11_2
$ curl -O https://raw.githubusercontent.com/kubo/fix_oralib_osx/master/fix_oralib.rb
$ ruby -a fix_oralib.rb
adrci:
   add rpath: @loader_path
   change install name
     from: /ade/b/3071542110/oracle/rdbms/lib/libclntsh.dylib.11.1
       to: @rpath/libclntsh.dylib.11.1
   change install name
     from: /ade/dosulliv_ldapmac/oracle/ldap/lib/libnnz11.dylib
       to: @rpath/libnnz11.dylib

genezi:
   add rpath: @loader_path
   change install name
     from: /ade/b/3071542110/oracle/rdbms/lib/libclntsh.dylib.11.1
       to: @rpath/libclntsh.dylib.11.1

libclntsh.dylib.11.1:
   add rpath: @loader_path
   change identification name
     from: /ade/b/3071542110/oracle/rdbms/lib/libclntsh.dylib.11.1
       to: @rpath/libclntsh.dylib.11.1
   change install name
     from: /ade/dosulliv_ldapmac/oracle/ldap/lib/libnnz11.dylib
       to: @rpath/libnnz11.dylib

libnnz11.dylib:
   change identification name
     from: /ade/dosulliv_ldapmac/oracle/ldap/lib/libnnz11.dylib
       to: @rpath/libnnz11.dylib

libocci.dylib.11.1:
   change identification name
     from: /ade/b/3071542110/oracle/rdbms/lib/libocci.dylib.11.1
       to: @rpath/libocci.dylib.11.1

libociei.dylib:
   add rpath: @loader_path
   change install name
     from: /ade/b/3071542110/oracle/rdbms/lib/libclntsh.dylib.11.1
       to: @rpath/libclntsh.dylib.11.1

libocijdbc11.dylib:
   add rpath: @loader_path
   change install name
     from: /ade/b/2475221476/oracle/rdbms/lib/libclntsh.dylib.11.1
       to: @rpath/libclntsh.dylib.11.1
   change install name
     from: /ade/b/2475221476/oracle/ldap/lib/libnnz11.dylib
       to: @rpath/libnnz11.dylib

uidrvci:
   add rpath: @loader_path
   change install name
     from: /ade/b/3071542110/oracle/rdbms/lib/libclntsh.dylib.11.1
       to: @rpath/libclntsh.dylib.11.1
   change install name
     from: /ade/dosulliv_ldapmac/oracle/ldap/lib/libnnz11.dylib
       to: @rpath/libnnz11.dylib

$ pip install cx_oracle
Collecting cx-oracle
Installing collected packages: cx-oracle
Successfully installed cx-oracle-5.2

$ python -c "import cx_Oracle"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: dlopen(/Users/me/sx_direct_env/lib/python2.7/site-packages/cx_Oracle.so, 2): Library not loaded: /b/227/rdbms/lib/libclntsh.dylib.10.1
  Referenced from: /Users/me/sx_direct_env/lib/python2.7/site-packages/cx_Oracle.so
  Reason: image not found

推荐答案

我认为我已修复它.基本上我上面发布的步骤中的所有内容都是正确的.

I think I fixed it. Basically everything in my steps posted above were correct.

但是我最终在安装pip时使用了它,以确保它能够拉下新副本并进行重建(并可能获得更高的版本?)

But I ended up using this for the pip install to make sure it pulls down a new copy and rebuilds (and maybe gets a later version??)

$ pip install --no-cache-dir --allow-external --allow-unverified cx_oracle

然后,我能够毫无问题地导入cx_oracle,但在连接到外部服务器时出现错误'ORA-21561:OID生成失败'".

I was then able to import cx_oracle without issues but I was getting an error "'ORA-21561: OID generation failed'" when connecting to the external server.

然后,我遵循了此处的说明,并在/etc/hosts文件中添加了一行带有我的主机名的文件,现在一切正常.

Then I followed the instructions here and added a line with my host name to the /etc/hosts file and it all works now.

例如,在/etc/hosts的末尾添加这样的一行

e.g., added a line like this at the end of /etc/hosts

127.0.0.1本地主机我的主机名

127.0.0.1 localhost my-host-name

这篇关于如何在El Capitan上安装cx_Oracle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 05:36