pythonoraclepy2execx-oracle

Py2exe with cx_oracle. Exe won't run on other computers


I created a short script that connects to an Oracle db and pulls some data. This works on my PC as I have everything installed E.g. pycharm with cx_oracle etc. I want to be able to run this on other devices without the need installing other software. I used py2exe to create an executable which works fine on my pc however when I try running it on another device I received an error DPI-1047: CANNOT LOCATE A 64-BIT ORACLE CLIENT LIBRARY. Module could not be found

I understand the error but I was hoping everything that is needed to run the exe would be exported by using py2exe. I don't want others to have the hassle of installing additional software

Advice on how to get around this or if there is a different option

Zipped the entire dist folder , extracted onto another PC and attempted to run exe Used the recommended py2exe


Solution

  • Use python-oracledb (pip install oracledb) instead of cx_Oracle

    From the documentation:

    By default, python-oracledb runs in a ‘Thin’ mode which connects directly to Oracle Database. This mode does not need Oracle Client libraries. ...

    cx_Oracle always runs in a Thick mode using Oracle Client libraries.

    Edit: to be clear, as @thatjeffsmith points out, oracledb has supplanted cx_Oracle:

    New projects should install python-oracledb instead of cx_Oracle.