繁体   English   中英

Mac OSX Sierra Python 3.5.2 cx_oracle安装失败

[英]Mac OSX Sierra Python 3.5.2 cx_oracle installation failed

我正在尝试使用cx_Oracle模块将Python与我的Oracle数据库连接。 我尝试在最近几个小时内安装它,但找不到我的问题的答案。

使用以下命令安装cx_oracle时: pip install cx_oracle

Collecting cx_oracle
  Using cached cx_Oracle-5.2.1.tar.gz
Building wheels for collected packages: cx-oracle
  Running setup.py bdist_wheel for cx-oracle ... error
  Complete output from command /Users/dunker/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/x2/shhmzq692yx16cmgnmm8wgqm0000gn/T/pip-build-u1fc6kgz/cx-oracle/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /var/folders/x2/shhmzq692yx16cmgnmm8wgqm0000gn/T/tmpdol0yxgqpip-wheel- --python-tag cp35:
  running bdist_wheel
  running build
  running build_ext
  building 'cx_Oracle' extension
  creating build
  creating build/temp.macosx-10.6-x86_64-3.5-12c
  /usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/dunker/anaconda3/include -arch x86_64 -I/Library/Oracle/instantclient_11_2/sdk/include -I/Users/dunker/anaconda3/include/python3.5m -c cx_Oracle.c -o build/temp.macosx-10.6-x86_64-3.5-12c/cx_Oracle.o -DBUILD_VERSION=5.2.1
  In file included from cx_Oracle.c:203:
  In file included from ./SessionPool.c:138:
  In file included from ./Connection.c:761:
  In file included from ./Cursor.c:246:
  In file included from ./Variable.c:171:
  ./NumberVar.c:372:26: warning: absolute value function 'abs' given an argument of type 'long' but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value]
      length = numDigits + abs(scale) + 3;
                           ^
  ./NumberVar.c:372:26: note: use function 'labs' instead
      length = numDigits + abs(scale) + 3;
                           ^~~
                           labs
  In file included from cx_Oracle.c:203:
  In file included from ./SessionPool.c:138:
  In file included from ./Connection.c:761:
  In file included from ./Cursor.c:246:
  In file included from ./Variable.c:176:
  ./ObjectVar.c:118:19: warning: comparison of integers of different signs: 'int' and 'ub4' (aka 'unsigned int') [-Wsign-compare]
      for (i = 0; i < self->allocatedElements; i++) {
                  ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~
  ./ObjectVar.c:135:19: warning: comparison of integers of different signs: 'int' and 'ub4' (aka 'unsigned int') [-Wsign-compare]
      for (i = 0; i < self->allocatedElements; i++) {
                  ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~
  In file included from cx_Oracle.c:203:
  In file included from ./SessionPool.c:138:
  In file included from ./Connection.c:761:
  In file included from ./Cursor.c:246:
  ./Variable.c:926:32: warning: comparison of integers of different signs: 'ub4' (aka 'unsigned int') and 'int' [-Wsign-compare]
      if (var->allocatedElements < cursor->fetchArraySize) {
          ~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~
  In file included from cx_Oracle.c:203:
  In file included from ./SessionPool.c:138:
  In file included from ./Connection.c:761:
  ./Cursor.c:2440:19: warning: comparison of integers of different signs: 'int' and 'ub4' (aka 'unsigned int') [-Wsign-compare]
      for (i = 0; i < rowCountArraySize; i++) {
                  ~ ^ ~~~~~~~~~~~~~~~~~
  In file included from cx_Oracle.c:203:
  In file included from ./SessionPool.c:138:
  In file included from ./Connection.c:764:
  ./Subscription.c:451:19: warning: comparison of integers of different signs: 'ub4' (aka 'unsigned int') and 'sb4' (aka 'int') [-Wsign-compare]
      for (i = 0; i < numRows; i++) {
                  ~ ^ ~~~~~~~
  ./Subscription.c:526:19: warning: comparison of integers of different signs: 'ub4' (aka 'unsigned int') and 'sb4' (aka 'int') [-Wsign-compare]
      for (i = 0; i < numTables; i++) {
                  ~ ^ ~~~~~~~~~
  ./Subscription.c:618:23: warning: comparison of integers of different signs: 'ub4' (aka 'unsigned int') and 'sb4' (aka 'int') [-Wsign-compare]
          for (i = 0; i < numTables; i++) {
                      ~ ^ ~~~~~~~~~
  ./Subscription.c:660:23: warning: comparison of integers of different signs: 'ub4' (aka 'unsigned int') and 'sb4' (aka 'int') [-Wsign-compare]
          for (i = 0; i < numQueries; i++) {
                      ~ ^ ~~~~~~~~~~
  **9 warnings generated.**
  creating build/lib.macosx-10.6-x86_64-3.5-12c
  /usr/bin/clang -bundle -undefined dynamic_lookup -L/Users/dunker/anaconda3/lib -arch x86_64 build/temp.macosx-10.6-x86_64-3.5-12c/cx_Oracle.o -L/Library/Oracle/instantclient_11_2 -L/Users/dunker/anaconda3/lib -lclntsh -o build/lib.macosx-10.6-x86_64-3.5-12c/cx_Oracle.cpython-35m-darwin.so -shared-libgcc
  ld: library not found for -lclntsh
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  error: command '/usr/bin/clang' failed with exit status 1

  ----------------------------------------
  Failed building wheel for cx-oracle
  Running setup.py clean for cx-oracle
Failed to build cx-oracle
Installing collected packages: cx-oracle
  Running setup.py install for cx-oracle ... error
    Complete output from command /Users/dunker/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/x2/shhmzq692yx16cmgnmm8wgqm0000gn/T/pip-build-u1fc6kgz/cx-oracle/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/x2/shhmzq692yx16cmgnmm8wgqm0000gn/T/pip-jk8j3nz6-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    building 'cx_Oracle' extension
    creating build
    creating build/temp.macosx-10.6-x86_64-3.5-12c
    /usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/dunker/anaconda3/include -arch x86_64 -I/Library/Oracle/instantclient_11_2/sdk/include -I/Users/dunker/anaconda3/include/python3.5m -c cx_Oracle.c -o build/temp.macosx-10.6-x86_64-3.5-12c/cx_Oracle.o -DBUILD_VERSION=5.2.1
    In file included from cx_Oracle.c:203:
    In file included from ./SessionPool.c:138:
    In file included from ./Connection.c:761:
    In file included from ./Cursor.c:246:
    In file included from ./Variable.c:171:
    ./NumberVar.c:372:26: warning: absolute value function 'abs' given an argument of type 'long' but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value]
        length = numDigits + abs(scale) + 3;
                             ^
    ./NumberVar.c:372:26: note: use function 'labs' instead
        length = numDigits + abs(scale) + 3;
                             ^~~
                             labs
    In file included from cx_Oracle.c:203:
    In file included from ./SessionPool.c:138:
    In file included from ./Connection.c:761:
    In file included from ./Cursor.c:246:
    In file included from ./Variable.c:176:
    ./ObjectVar.c:118:19: warning: comparison of integers of different signs: 'int' and 'ub4' (aka 'unsigned int') [-Wsign-compare]
        for (i = 0; i < self->allocatedElements; i++) {
                    ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~
    ./ObjectVar.c:135:19: warning: comparison of integers of different signs: 'int' and 'ub4' (aka 'unsigned int') [-Wsign-compare]
        for (i = 0; i < self->allocatedElements; i++) {
                    ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~
    In file included from cx_Oracle.c:203:
    In file included from ./SessionPool.c:138:
    In file included from ./Connection.c:761:
    In file included from ./Cursor.c:246:
    ./Variable.c:926:32: warning: comparison of integers of different signs: 'ub4' (aka 'unsigned int') and 'int' [-Wsign-compare]
        if (var->allocatedElements < cursor->fetchArraySize) {
            ~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~
    In file included from cx_Oracle.c:203:
    In file included from ./SessionPool.c:138:
    In file included from ./Connection.c:761:
    ./Cursor.c:2440:19: warning: comparison of integers of different signs: 'int' and 'ub4' (aka 'unsigned int') [-Wsign-compare]
        for (i = 0; i < rowCountArraySize; i++) {
                    ~ ^ ~~~~~~~~~~~~~~~~~
    In file included from cx_Oracle.c:203:
    In file included from ./SessionPool.c:138:
    In file included from ./Connection.c:764:
    ./Subscription.c:451:19: warning: comparison of integers of different signs: 'ub4' (aka 'unsigned int') and 'sb4' (aka 'int') [-Wsign-compare]
        for (i = 0; i < numRows; i++) {
                    ~ ^ ~~~~~~~
    ./Subscription.c:526:19: warning: comparison of integers of different signs: 'ub4' (aka 'unsigned int') and 'sb4' (aka 'int') [-Wsign-compare]
        for (i = 0; i < numTables; i++) {
                    ~ ^ ~~~~~~~~~
    ./Subscription.c:618:23: warning: comparison of integers of different signs: 'ub4' (aka 'unsigned int') and 'sb4' (aka 'int') [-Wsign-compare]
            for (i = 0; i < numTables; i++) {
                        ~ ^ ~~~~~~~~~
    ./Subscription.c:660:23: warning: comparison of integers of different signs: 'ub4' (aka 'unsigned int') and 'sb4' (aka 'int') [-Wsign-compare]
            for (i = 0; i < numQueries; i++) {
                        ~ ^ ~~~~~~~~~~
    9 warnings generated.
    creating build/lib.macosx-10.6-x86_64-3.5-12c
    /usr/bin/clang -bundle -undefined dynamic_lookup -L/Users/dunker/anaconda3/lib -arch x86_64 build/temp.macosx-10.6-x86_64-3.5-12c/cx_Oracle.o -L/Library/Oracle/instantclient_11_2 -L/Users/dunker/anaconda3/lib -lclntsh -o build/lib.macosx-10.6-x86_64-3.5-12c/cx_Oracle.cpython-35m-darwin.so -shared-libgcc
    ld: library not found for -lclntsh
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    error: command '/usr/bin/clang' failed with exit status 1

我收到这种错误消息。 我遵循了10多个教程,但似乎找不到答案。 设置正确的环境变量,其他所有工作。

好的,所以我发现了错误:

在我的情况下,转到您的$ORACLE_HOME是/ library / oracle / instantclient_11_2

ln -s libclntsh.dylib.12.1 libclntsh.dylib

接着

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

为我工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM