Reputation: 1496
I have a python script that depends on pycrypto
, boto3
and pyYaml
. I have to deliver this script to a client who is strictly non-technical and maynot even have access to the internet.
Is there a way to package everything up together so that the client can just extract the zip file and have the script working for him out of the box? Also, the script should be able to run on Windows/Mac/Linux and they can each have their own .zip files as well.
I have worked with pip
, requirements.txt
and setuptools
in the past but have never done something very rudimentary like this. What is the best way of achieving this?
Upvotes: 3
Views: 1410
Reputation: 22443
If you are deploying on Windows, py2exe will help you build a stand-alone executable. Look for the -c
and --bundle-files
options, which together will bundle files into a compressed archive with your executable.
If deploying to Mac, try py2app instead.
In my experience, such bundlers are fussy, requiring at least some fiddling and experimentation. Some popular Python packages (e.g. PIL/Pillow, lxml, numpy, pandas, anything requiring a native C runtime) may have gotchas when mixed with bundler tools. So do not just bundle and deliver to a non-technical customer. Test and (if necessary) tweak before delivery.
This isn't a complete list of ways to install or deliver Python code. A few others from vinta's awesome python list.
Upvotes: 5