安装cx_oracle失败

时间:2014-04-30 16:35:59

标签: macos cx-oracle

我正在尝试在我的Mac Mavericks上安装cx_Oracle。遇到以下错误。请帮忙。

序列是:

sudo easy_install cx_Oracle
...
Processing cx_Oracle-5.1.2.tar.gz
Writing /tmp/easy_install-eFOU_a/cx_Oracle-5.1.2/setup.cfg
Running cx_Oracle-5.1.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-eFOU_a/cx_Oracle-5.1.2/egg-dist-tmp-g2eCKt
ld: file not found: crt3.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: Setup script exited with error: command '/usr/bin/clang' failed with exit status 1

2 个答案:

答案 0 :(得分:1)

我没有深入挖掘,但我找到了解决此问题的方法。 我从https://bitbucket.org/anthony_tuininga/cx_oracle克隆了回购并运行了

python setup.py build

出现错误:

/usr/bin/clang -bundle -undefined dynamic_lookup -L/usr/local/opt/readline/lib build/temp.macosx-10.4-x86_64-2.7-11g/cx_Oracle.o -L/opt/instantclient_11_2 -lclntsh -o build/lib.macosx-10.4-x86_64-2.7-11g/cx_Oracle.so -shared-libgcc
ld: file not found: crt3.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/bin/clang' failed with exit status 1

之后我只是复制&从输出中粘贴命令

/usr/bin/clang -bundle -undefined dynamic_lookup -L/usr/local/opt/readline/lib build/temp.macosx-10.4-x86_64-2.7-11g/cx_Oracle.o -L/opt/instantclient_11_2 -lclntsh -o build/lib.macosx-10.4-x86_64-2.7-11g/cx_Oracle.so -shared-libgcc

跑了

python setup.py install

SUDDENLY蛋已成功安装。

希望这有帮助。

答案 1 :(得分:0)

  1. 首先从Oracle站点下载oracle mac客户端文件,下面两个
  2.   

    Instant Client Package - Basic:运行OCI,OCCI所需的所有文件

         

    Instant Client Package - SQL Plus:其他库和可执行文件   使用Instant Client运行SQL Plus

    1. 然后解压缩并放入单个文件夹。 现在指出mac的“LD LIBRARY PATH”路径为下面显示的两个环境变量导出
    2.   

      出口   DYLD_LIBRARY_PATH = /用户/名为myUsername /桌面/ ORA_CLIENT / oracle_client   export LD_LIBRARY_PATH = $ LD_LIBRARY_PATH:   /用户/名为myUsername /桌面/ ORA_CLIENT / oracle_client

      1. 现在下载cx_oracle源代码tar ball,解压缩到源文件夹,运行
      2.   

        pip setup.py install

        1. 将收到以下错误
        2.   

          ld:找不到文件:crt3.o

          1. 现在将gcc bundle命令复制到命令行运行输出上方(下面粘贴的样本)
          2.   

            gcc -bundle -undefined dynamic_lookup   建立/ temp.macosx-10.4 x86_64-2.7-11g / cx_Oracle.o   -L / Users / myUserName / Desktop / ORA_CLIENT / oracle_client -lclntsh -o build / lib.macosx-10.4-x86_64-2.7-11g / cx_Oracle.so -shared-libgcc

            1. 将其粘贴到命令行中,然后按Enter键。它会通过。现在运行“python setup.py install”。它将完成