install cx_oracle for python

后端 未结 11 1752
逝去的感伤
逝去的感伤 2021-01-30 04:27

Am on Debian 5, I\'ve been trying to install cx_oracle module for python without any success. First, I installed oracle-xe-client and its dependency (followed tutorial in the fo

相关标签:
11条回答
  • 2021-01-30 04:45

    This worked for me

    python -m pip install cx_Oracle --upgrade
    

    For details refer to the oracle quick start guide

    https://cx-oracle.readthedocs.io/en/latest/installation.html#quick-start-cx-oracle-installation

    0 讨论(0)
  • 2021-01-30 04:47

    Thx Burhan Khalid, I overlooked your "You need to be root" quote, but found the way when you are not the root here.

    At point 7 you need to use:

    sudo env ORACLE_HOME=$ORACLE_HOME python setup.py install 
    

    Or

    sudo env ORACLE_HOME=/path/to/instantclient python setup.py install
    
    0 讨论(0)
  • 2021-01-30 04:47

    If you are trying to install in MAC , just unzip the Oracle client which you downloaded and place it into the folder where you written python scripts. it will start working.

    There is too much problem of setting up environmental variables. It worked for me.

    Hope this helps.

    Thanks

    0 讨论(0)
  • 2021-01-30 04:48

    I think it may be the sudo has no access to get ORACLE_HOME.You can do like this.

    sudo visudo

    modify the text add

    Defaults env_keep += "ORACLE_HOME"

    then

    sudo python setup.py build install

    0 讨论(0)
  • 2021-01-30 04:55

    The following worked for me, both on mac and Linux. This one command should download needed additional files, without need need to set environment variables.

    python -m pip install cx_Oracle --pre
    

    Note, the --pre option is for development and pre-release of the Oracle driver. As of this posting, it was grabbing cx_Oracle-6.0rc1.tar.gz, which was needed. (I'm using python 3.6)

    0 讨论(0)
  • 2021-01-30 04:59

    Thanks Burhan Khalid. Your advice to make a a soft link make my installation finally work.

    To recap:

    1. You need both the basic version and the SDK version of instant client

    2. You need to set both LD_LIBRARY_PATH and ORACLE_HOME

    3. You need to create a soft link (ln -s libclntsh.so.12.1 libclntsh.so in my case)

    None of this is documented anywhere, which is quite unbelievable and quite frustrating. I spent over 3 hours yesterday with failed builds because I didn't know to create a soft link.

    0 讨论(0)
提交回复
热议问题