sql >> データベース >  >> RDS >> Oracle

エルキャピタンにcx_Oracleをインストールする方法

    上記を試みたところ、Oracle instanceclient 12.1 を使用してcx_Oracleをインストールしようとしたときに、次のエラーが発生しました。 :

    [535]: /opt/instantclient_12_1 $ python -c "import cx_Oracle"
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ImportError: dlopen(/Library/Python/2.7/site-packages/cx_Oracle.so, 2): 
            Library not loaded: @rpath/libclntsh.dylib.12.1
      Referenced from: /Library/Python/2.7/site-packages/cx_Oracle.so
      Reason: image not found
    

    @rpathに注目してください エラーの場合-cx_Oracleライブラリをビルドするときに(instantclient 12.1の場合) El Capitanでは、gccコンパイラは、前述のダイナミックリンクライブラリ(* .dylib)の場所を知るために-rpathフラグが設定されていることを想定しています。デフォルトでは、instantclient 12.1では、 pip あなたのためにこれをしません。

    # Set -rpath option before installing...this will use $ORACLE_HOME during compilation
    export FORCE_RPATH=TRUE
    pip install cx_Oracle
    # And verify cx_Oracle was correctly installed
    python -c "import cx_Oracle"
    # If this line fails install cx_Oracle with:
    #   pip install --no-cache-dir --allow-external --allow-unverified cx_oracle
    

    python -c "import cx_Oracle" エラーは報告されません。

    完全なインストールガイド(instantclientのダウンロードと構成を含む)については、の私の投稿を確認してください。 http://thelaziestprogrammer.com/sharrington/databases/oracle/install-cx_oracle-mac 詳細については。



    1. MariaDBで日付に年を追加する6つの方法

    2. Oracle Select Max Date on Multiple records

    3. Postgres CSV COPY from/importはCSVヘッダーを尊重していません

    4. Python From Scratch:動的なWebサイトを作成する