Scroll down to read the Solution
I've made a little project that includes importing various python files into another python files. Here's my directory structure.
|_ Sites (a directory inside Main_Folder)
from Sites import *
# -*- mode: python -*-
block_cipher = None
a = Analysis(['my_main_file.py'],
pyz = PYZ(a.pure, a.zipped_data,
exe = EXE(pyz,
I would suggest you to use
cx_Freeze, the best python code bundler in my opinion.
The installation is pretty straight-forward, just download and install this cx_Freeze installer (this one if you are on python 3.4) taken from the official PyPi package site. Once this is done, open cmd and run
The fastest way of doing it is opening a command prompt on your project's parent directory and running
cxfreeze <your .py script>. This will create a dist folder which contains your main program and all the modules it imports.
However, if you want to go advanced and have a wider selection of options when making your code an executable, you can make a
setup.py as explained here and then run in a cmd
python setup.py build. Unlike the previous method this creates a directory named
build which contains another directory with the name of the platform you are compiling on. Now, inside it there is the executable and the libraries.