Suppose I have a python script that uses many uncommon modules. I want to deploy this script to sites which are unlikely to have these uncommon modules. What are some convenient way to install and deploy this python script without having to run "pip" at all the sites?
I am using python v3.x
pyinstaller with spec file would be an option. uncommon modules should be specified in hidden import parameters
pyinstaller [options] script [script …] | specfile
deployment arguments can be stored in spec file and pyinstaller can be executed with the entry python file as following command
pyinstaller start.py myscript.spec
sample spec file
block_cipher = None
a = Analysis(['minimal.py'],
pathex=['/Developer/PItests/minimal'],
binaries=None,
datas=None,
hiddenimports=[],
hookspath=None,
runtime_hooks=None,
excludes=None,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,... )
coll = COLLECT(...)
see pyinstaller help for more details
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With