My goal is to use Pyinstaller to bundle an exe file from a simple python script that uses Tkinter and cx_oracle to access a database. The python code is developed on a windows machine with Anaconda, cx_oracle package and oracle client installed. Then I need to run the exe file in many target windows machines without oracle client or Python.
I am using Python 2.7 and Pyinstaller 3.1 on the development machine.
I searched quite a while online but only found one tutorial on this: https://mail.python.org/pipermail/tutor/2014-December/103608.html
I followed the same procedure and modified the spec file as below:
# -*- mode: python -*-
block_cipher = None
a = Analysis(['mycode.py'],
pathex=['C:\\Users\\myuser\\PycharmProjects\\mycode'],
binaries=None,
datas=None,
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries + [('oraociei11.dll','D:\ProgramFiles\Anaconda2\oraociei11.dll','BINARY')],
a.zipfiles,
a.datas,
name='mycode',
debug=False,
strip=False,
upx=True,
console=True )
the bundle worked. The code runs on the original machine with oracle client installed. But on a separate machine without oracle client, it failed to run, with the below error message:
Exception in Tkinter callback Traceback (most recent call last): File "lib-tk\Tkinter.py", line 1537, in call File "", line 152, in login DatabaseError: DPI-1047: 64-bit Oracle Client library cannot be loaded: "The specified module could not be found". See https://oracle.github.io/odpi/doc/installation.html#windows for help
Now I am very confused what are the required steps to safely bundle an exe from a python script with cx_oracle so that it can run on a windows machine without oracle client? Or do I "have to" install oracle client on the target machine?
I really hope to find a more detailed tutorial on bundling cx_oracle with pyinstaller than the old link I found above.