How we can bundle multiple python modules?

PythonServer Side ProgrammingProgramming

Assuming you are using Python 2.6 or later, you could package the scripts into a zip file, add a and run the zip file directly. For example, if you zip all files in a file called and place your main script in, you can run this zip using python:

$ python

If you want to use a third party script, you can have a look at stickytape module. It can be used to convert a Python script and any Python modules it depends into a single-file Python script. To install stickytape, open your terminal and enter:

$ pip install stickytape

Assuming all your scripts and dependencies reside in the script/sample folder, you can use stickytape in the following way:

$ stickytape scripts/sample --add-python-path . > ./sample-standalone

You can also use the --output-file parameter to give it a file argument:

$ stickytape scripts/sample --add-python-path . --output-file ./sample-standalone
Updated on 01-Oct-2019 06:53:19